Hi All,
Say I have a pet table and an owner table related to each other in a
one to many relationship (one owner has many pets). Each owner can
also define several pet types of their choosing.
db.create_table('owner',
Field('name', text))
db.create_table('pet_type',
Field('type_name','text'),
Field('type_owner',db.owner))
db.create_table('pet',
Field('pet_name', 'text'),
Field('pet_type'), db.pet_type),
Field('pet_owner'), db.pet_owner))
How do I create a model validator so that, when adding or editing a
pet associated with a particular owner, only pet_types "belonging" to
that owner show up in the form dropdown? (Owners can define their own
custom pet_types).
This rule displays ALL defined pet_types in the pet_type table, and
not simply the ones owned by a given owner.
db.pet.pet_type.requires = IS_IN_DB(db, 'pet_type.id', '%
(type_name)s')
Any help is much appreciated.
Joe