On Thursday, December 15, 2011 11:42:42 AM UTC-5, thodoris wrote:
>
> This is a solution but look at the following, if i declare
>
>
> db.define_table('person', 
> Field('name'),) 
>
> db.define_table('cat', 
> Field('name'), 
> Field('owner',"integer",db.person,default=db.person.id)) 
> db.cat.owner.requires = IS_IN_DB(db, db.person.id) 
> the reference is broken. Is there another solution?
>

If you want 'owner' to reference the 'person' table, then make it a 
'reference' field type, not 'integer':

Field('owner', db.person)

or

Field('owner', 'reference person')

Note, you can't set the default to db.person.id because that refers to the 
'id' field of the 'person' table, not a specific value for a given person.

Anthony 

Reply via email to