In db.py I define the following table:
def set_requirement(nodeRelatedName):
nodeRelatedName.relatedID.requires=[IS_IN_DB(db,'node.id','%(id)s',zero=T('select
a
value')),IS_NOT_IN_DB(db(db.nodeRelatedName.nodeID==request.vars.nodeID),'nodeRelatedName.relatedID',error_message=T('combination
node and related name already in database'))]
db.define_table('nodeRelatedName',
Field('nodeID','reference node',**isnode),
Field('relatedID','reference
node',default='',ondelete='CASCADE',notnull=True),
Field('insequence',type='integer',default=0,writable=False,readable=False),
Field('createdOn',**attributes),
Field('modifiedOn',update=request.now,**attributes),
on_define=set_requirement,
migrate=False)
The problem is that the validator doesn't work, I should prevent users from
adding the same combination of nodeID and relatedID twice or more, but it
doesn't. What's the correct syntax to implement this?
Kind regards,
Annet
--