I found that the way to make this work is to set the filtering
("requires" directive) in the controller instead of in the model.:) On Aug 12, 2:40 pm, noelrv <[email protected]> wrote: > I have issues implementing a filtered list of tags in a crud form > dropdown. > > In the models below, each book belongs to a category and has one or > more tags. Each category has a specified set of tags by defining > tag.categories as a list:reference. > > The crud form dropdown shows a filtered tag list if I explicitly > specify a value for "contains": > categorytags = db(db.tag.categories.contains(6)) > but not, if I use: > categorytags = db(db.tag.categories.contains(db.book.category)) > > db.define_table('category', > Field('name'), format='%(name)s') > > db.define_table('tag', > Field('name'), > Field('categories','list:reference category'), format='%(name)s') > > db.define_table('book', > Field('title'), > Field('category',db.category), > Field('tags','list:reference tag')) > categorytags = db(db.tag.categories.contains(db.book.category)) > db.book.tags.requires=IS_IN_DB(categorytags,'tag.id',db.tag._format,multiple=True)

