IS_IN_DB can take a set. It is mentioned in the book. Use something like: db(db.fruits.isactive==True) in place of db.fruits
On Tuesday, August 21, 2012 10:13:52 PM UTC+1, joe wrote: > > I have a support table with the field 'isactive', which is a boolean. > When someone is adding to a table that is supported by the first table, I > want only items with isactive as True to be included in the dropdown. Here > is some simplified example code: > > model > -------------------------- > db.define_table('fruits', > Field('name', requires = IS_NOT_EMPTY()), > Field('isactive', 'boolean')) > > db.define_table('grocery', > Field(fruits', db.fruits, requires = IS_EMPTY_OR(IS_IN_DB(db, > db.fruits, '%(name)s')), represent=lambda id, row: db.fruits(id).name if id > else '')) > --------------------------- > > In a SQLFORM generated from the grocery table, how can I only show fruits > that are active? > > Thanks! > -Joe Peacock > --