I have three fields that must be unique in a table, and based on the answer to this question I attempted the following (I think I understand this, but evidently not...monkey-see, monkey-do):
db.define_table('Person_certification',
Field('Person', db.Person),
Field('Certification', db.Certification),
Field('Start_date', 'date',
requires=IS_NOT_IN_DB(db(db.Person_certification.Person==request.vars.Person
& dp.Person_certification.Certification==request.vars.Certification),
'Person_certification.Start_date')),
Field('End_date', 'date'),
format='%(Person)s %(Certification)s')
The three fields are Person, Certification, and Start_date. When I try to use this I get:
<type 'exceptions.KeyError'> 'Person_certification'
The traceback refers to the 'requires' line. (There's already data in the table (and no duplicates on the three fields); is the code trying to make that check during a SELECT?)
What am I missing here?