This works:
db=SQLDB('sqlite://annet.db')
db.define_table('shape',
SQLField('name'),
SQLField('color'),
migrate='shape.table')
db.shape.color.requires=IS_NOT_IN_DB(db
(db.shape.name==request.vars.name),'shape.color')
I had forgotted the .vars in request.vars.name.
Notice that (highlighted in uppercase)
1) you are validating shape.color:
db.SHAPE.COLOR.requires=IS_NOT_IN_DB(db
(db.shape.name==request.vars.name),'SHAPE.COLOR')
2) with a condition that depends on another request.vars:
db.shape.color.requires=IS_NOT_IN_DB(db
(db.SHAPE.NAME==request.vars.NAME),'shape.color')
Massimo
On Jan 6, 11:21 am, annet <[email protected]> wrote:
> I replaced the constraint with:
>
> db.shape.name.requires=IS_NOT_IN_DB(db
> (db.shape.name==request.name),'shape.color')
>
> So, request.name instead of request.shape, but that didn't make any
> difference.
>
> Annet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---