[web2py] Re: Need Help Using CRUD with Self-Referencing Tables

2011-01-15 Thread SaltyCow
Thanks Savio, I created a clean app to test this out and it works great. Regards. >Jeff On Jan 14, 12:28 pm, Savio Sabino wrote: > Hi, the follow model is rigth to crud: > > db.define_table('category',iObj, >     Field('parent','reference category'), >     Field('name'), >     format='%(name)s')

[web2py] Re: Need Help Using CRUD with Self-Referencing Tables

2011-01-14 Thread Savio Sabino
Hi, the follow model is rigth to crud: db.define_table('category',iObj, Field('parent','reference category'), Field('name'), format='%(name)s') db.category.parent.requires = IS_EMPTY_OR(IS_IN_DB(db, db.category.id, '%(name)s')) db.category.name.requires = IS_NOT_IN_DB(db, db.category.

[web2py] Re: Need Help Using CRUD with Self-Referencing Tables

2011-01-13 Thread SaltyCow
Okay, I figured out what was wrong: 1. To make crud create produce a drop-down select for the reference field, I needed to add a "requires is_in_db" statement referencing the same table. That was a dumb oversight on my part. 2. The crud read needed to be replaced by a custom query using with_alia