Yes the validator are applied to forms only but you can also do

SQLField('name',notnull=True,unique=True)

and if web2py is creating the table, the constraints will be enforced
by the db.

Massimo

On Nov 3, 4:59 pm, michal niklas <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I started writing tool to create model from existing PostgreSQL
> database.
> At first I created cookbook db via web2py and now I translate it back
> from
> PostgreSQL schema to web2py model.
>
> I have mapped tables and columns and even foreign keys
> if they point to 'id' column of other table.
> But as I see validators such as IS_NOT_EMPTY() or IS_NOT_IN_DB()
> are not translated to SQL commands like:
> ... NOT NULL ...
> or
> CREATE UNIQUE INDEX ....
> I see that validators are only used by web2py and are not forced in db
> schema.
> Am I right?
>
> If answer is 'yes' then I think I will check if there is UNIQUE INDEX
> or NOT NULL clause and then add validator. Any better idea?
>
> Regards,
> Michal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to