On Jul 18, 1:00 pm, ionel <ionelanton...@gmail.com> 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")

Huh? table country has only one field.
Something is amiss here.

>
> Problem:
>
> There is no country.id = -1 in the country table, but INSERT is
> executed despite the validator
>
> 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 web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to