db.engine.company.requires = IS_IN_DB(db(db.company.approved == True),'company.id','%(name)s')
On Thursday, 3 January 2013 23:36:18 UTC-6, Dave Cenker wrote: > > I have a set of models defined as follows: > > db.define_table('company', > Field('name'), > Field('symbol'), > Field('approved', 'boolean')) > > db.define_table('locomotive', > Field('manufacturer'), > Field('model'), > Field('approved', 'boolean'), > > db.define_table('engine', > Field('company', db.company), > Field('locomotive', db.locomotive)) > > The intent of the 'approved' fields are to limit what is displayed to the > user in form select lists until they have been approved by someone with an > admin role. > > I am attempting to limit the options in my engine controller create.crud > function to only make available the companies and locomotives that are > approved. I can obviously get this information easily using > db(db.company.approved == True).select() etc. However, I am trying how to > figure out how to get this filtered list of options into the select list > dropdown in the crud.create(db.engine) form. > > Any suggestions? I tried to create a custom form to do the same thing, but > it began to get really 'clunky'. > > Thanks in advance for any help! > > Dave > --