As steted on the book
Notice that requires=... is enforced at the level of forms, required=Trueis
enforced at the level of the DAL (insert), while
notnull, unique and ondelete are enforced at the level of the database.
While they sometimes may seem redundant, it is important to maintain the
distinction when programming with the DAL.
also, you may want to add a requires=IS_NOT_EMPTY() validator for nice
error reporting...
On Wednesday, September 5, 2012 7:39:24 PM UTC+2, mjm wrote:
>
> I have defined a simple table:
>
> db.define_table('hoortoestel',
> # algemeen
> Field('merk', type='string', required=True, ),
> Field('type', type='string', required=True, ),
> ...
>
> If I then try to enter a new record in appadmin and do not enter anything
> for the fields, the record is still accepted and entered into the (SQLite)
> database. I would have expected the DAL to refuse the values.
> If I change the constraints from required=True to notnull=True, the empty
> values are not accepted.
>
> Bug or oversight by me?
>
>
--