Hi,
So regarding web2py validators:
When I define my model using the unique=True constraint on a field, it
adds an IS_NOT_IN_DB validator to that field. But if I try to do a
validate_and_update on that field, it throws an error in the following
examples:

Case 1: Passing in the whole record

Say I have a row:
name: production (unique)
tag: large

And I want to make a change to tag to say "small"
If I try to pass in validate_and_update(tag='small',name='production')
I get an error saying "production" is already in the database.

Case 2: Changing case

Say I have a row:
name: production (unique)
tag: large

And I want to change the name to start with an uppercase letter.

If I try to pass in validate_and_update(name='Production') I get an
error saying "Production" is already in the database (as it appears to
be case-insenstive) but if I update without the validator it works.

So any ideas on how to properly validate my updates for both cases?

Reply via email to