you can have
requires=IS_IN_DB(....,_and=IS_NOT_IN_DB(...))
and/or
requires=IS_IN_DB(db(condition),....)
Mind that the example in the cookbook 3 years old.
It works but now you do not all those validators. They are set by
default:
import datetime
now=datetime.date.today()
db=DAL('mysql://cookbook:[email protected]/cookbook')
db.define_table('category',
Field('name',length=32,notnull=True,unique=True)
format='%(name)s')
db.define_table('recipe',
Field('title',length=32,nutnull=True),
Field('description',length=256,notnull=True),
Field('category',db.category),
Field('pub_date','date',default=now),
Field('instructions','text'))
# Notice no validators needed!
Mind that I changed Field('date') into Field('pub_date') because
'date' is not a valid SQL field name. The cookbook would only work on
sqlite because of this.
On Feb 11, 7:33 am, "[email protected]"
<[email protected]> wrote:
> We have a small problem in the use of IS_IN_DB. Only you can use this, and
> if
> want to use a IS_NOT_EMPTY for example, does not display the dropdown list.
> _____________________________________________
> *Gilson Filho*
> *Web Developerhttp://gilsondev.com*