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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---