def run(): db.define_table('user_table', Field('birthday', 'date', unique=True)) grid = SQLFORM.grid(db.user_table.id, user_signature=False) return {'grid':grid}UNIQUE constraint failed: user_table.birthday
Anthony
What is odd to me is that,on postgres the validator works as expected while on sqlite it doesn‘t and it is the backend itself that raises the exception.
Are you saying you want an error message to appear on the form? For that, you need an IS_NOT_IN_DB validator, regardless of the database backend.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/AnmLhKmS8UA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
db.user_table.birthday.requires=[IS_DATE(), IS_NOT_IN_DB(db,'user_table.birthday')]
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
if field.unique:
requires.insert(0,validators.IS_NOT_IN_DB(db,field))