Ok so I removed the db. from all the references.  I am still getting a
similar error about tables not existing.

======
Traceback (most recent call last):
  File "/var/www/web2py/gluon/restricted.py", line 184, in restricted
    exec ccode in environment
  File "/var/www/web2py/applications/inventory/models/db.py", line 74,
in <module>
    Field('review', 'reference review'))
  File "/var/www/web2py/gluon/sql.py", line 1195, in define_table
    t._create_references()
  File "/var/www/web2py/gluon/sql.py", line 1454, in
_create_references
    raise SyntaxError, 'Table: table \'%s\'does not exist' %
referenced
SyntaxError: Table: table 'product_description'does not exist

=====

On Nov 9, 6:55 am, Mladen Milankovic <mml...@gmail.com> wrote:
> Hi.
>
> When using reference you don't need the db. part. Only the name of the table.
>
> Like:
> Field('description', 'reference product_description'),
>
> It uses the same database as the table you are just creating.
>
> regards
> mmlado
>
> On Monday 09 November 2009 13:51:05 David wrote:
>
> > So I have the following code and it's not generating tables but
> > perhaps my thinking isn't quite clear on this.  I can't link two
> > tables unless one exists previously and that table cannot reference
> > any other table that is not created unless a reference is used....
> > explain why this gives me "Tables do not exist" errors no matter which
> > order I use...
>
> > db.define_table('product',
> >     Field('date_added', 'datetime'),
> >     Field('date_available', 'datetime'),
> >     Field('name', length=55),
> >     Field('quantity', 'integer'),
> >     Field('price', length=10),
> >     Field('description', 'reference db.product_description'),
> >     Field('image', 'reference db.image'),
> >     Field('review', 'reference db.review'))
>
> > db.define_table('image',
> >     Field('product_id', 'reference db.product'),
> >     Field('name'),
> >     Field('file', 'upload'))
>
> > db.define_table('product_description',
> >     Field('prduct_id', 'reference db.product'),
> >     Field('description', 'text'))
>
> > db.define_table('review',
> >     Field('product_id', 'reference db.product'),
> >     Field('rating'),
> >     Field('review', 'text'))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to