I'm editing my data model in db.py and trying to add a field to a table of 
accounts that groups them using a foreign key.

        Field('group', 'reference groups', ondelete='CASCADE', 
required=True, default=db(db.groups).select().first().id),

                causes a ticket that reads: and causes web2py to freeze 
(must force quit and reopen); however,

        Field('groupd', 'reference groups', ondelete='CASCADE', 
required=True, default=db(db.groups).select().first().id),

                works fine.

Can someone explain why this is? Also, is there a better/more elegant way 
to specify a default for 'reference' types? Basically I want the default to 
be the first entry in the 'groups' table (which is a generic 'ungrouped' 
group).

Thank you for any help, I'm a web2py noob coming from a PHP/MySQL 
background.

-- 



Reply via email to