sorry:
db.define_table('y',
db.Field('name','string')
)
db.define_table('x',
db.Field('y_id',db.y,requires=IS_IN_DB(db,'y.id','%(name)s')),
db.Field('name','string'),
)
db.x.name.requires=[
IS_NOT_EMPTY(),
IS_NOT_IN_DB(db(db.x.y_id==request.vars.y_id),'x.name')
]
On Jun 27, 11:39 pm, weheh <[email protected]> wrote:
> Massimo, unfortunately, the suggestion didn't work. I got a traceback
> that ends with:
>
> Traceback (most recent call last):
> File "gluon/restricted.py", line 107, in restricted
> File "C:/web2py/applications/test/models/test.py", line 8, in
> <module>
> File "gluon/sql.py", line 525, in __getattr__
> KeyError: 'x'
>
> The entire test case is:
>
> db.define_table('y',
> db.Field('name','string')
> )
> db.define_table('x',
> db.Field('y_id',db.y,requires=IS_IN_DB(db,'y.id','%(name)s')),
> db.Field('name','string',requires=[
> IS_NOT_EMPTY(),
> IS_NOT_IN_DB(db(db.x.y_id==request.vars.y_id),'x.name')
> ]
> ),
> )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---