> > > 1. in example above i didn't define requires=IS_NOT_EMPTY(), yet i still > can submit and get the data >
you are not using any form to insert the data, so requires= won't get considered anyway. as for database constraints, The only field missing is grand_total, so the db should raise an error. I can't reproduce your behaviour (in the sense that for a fresh table with your definition an exception is raised because grand_total is missing) >>> db.define_table('tests4', Field('something', 'decimal(10,2)', notnull= True), Field('other')) <Table tests4 (id,something,other)> >>> db.tests4.insert(other='a') Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/niphlod/web2py/gluon/dal.py", line 7918, in insert ret = self._db._adapter.insert(self,self._listify(fields)) File "/home/niphlod/web2py/gluon/dal.py", line 1176, in insert raise e IntegrityError: tests4.something may not be NULL 2. in example above i didn't define requires=IS_LENGTH(), yet i still can > submit and get the data invoice that is more than i define in models > again, requires is not needed if you don't use form to insert the data, so requires is not needed. But, if you're using SQLite, it's still possible to insert data longer than the definition of the field: it's one of the shortcomings of it's small codebase, such as inserting a number into a char column. Anyway, there's nothing web2py can do. > 3. uuid is not work in unique=True, it returns an error, said invoice_no > is not unique, i think that uuid is unique id. > Strange, but again, web2py can't do nothing about it if the database returns an error. That being said, I can't reproduce the issue, even in SQLite. >>> db.define_table('tests2', Field('something', unique=True)) <Table tests2 (id,something)> >>> db.tests2.insert(something='12345678901234567890123') 1 >>> db.tests2.insert(something='12345678901234567890123') Traceback (most recent call last): File "<console>", line 1, in <module> File "/home/niphlod/web2py/gluon/dal.py", line 7918, in insert ret = self._db._adapter.insert(self,self._listify(fields)) File "/home/niphlod/web2py/gluon/dal.py", line 1176, in insert raise e IntegrityError: column something is not unique >>> db.tests2.insert(something='123456789012345678901232') 2 tl;dr : seems that you triggered various migrations and your db schema isn't in sync with your models (can happen, especially with SQLite). Try with a fresh database and report back. If it continues to do what you say it does, pack a small app and attach it here so we can reproduce it. PS: if you want the validators to check for your data before the insert, use validate_and_insert() instead of insert() -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.