On Sat, Jul 18, 2009 at 1:00 PM, ionel <[email protected]> wrote:
>
> Hello,
> I have the following situation:
>
> Model:
>
> db.define_table('country', db.Field('country', 'string', length=50))
>
> db.define_table(region',
> db.Field('name', 'string', length=50),
> db.Field('country', 'reference country')
> )
> db.region.country.requires=IS_IN_DB(db, 'country.id', '%(country)s',
> orderby=db.country.country)
>
> Controller:
>
> def test():
> country_id = db.country.insert(country=-1, region="Same
> region")
>
> Problem:
>
> There is no country.id = -1 in the country table, but INSERT is
> executed despite the validator
db.region.country.requires is a validator; it is not a constraint on DAL; it
is on SQLForm;
>
> db.region.country.requires=IS_IN_DB(db, 'country.id', '%(country)s',
> orderby=db.country.country)
>
> Is this an expected behavior?
>
> Thanks.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---