Re: [web2py] Re: wrong record getting selected in recursive select

2016-09-04 Thread brooks lee
Thanks a lot! On Sat, Sep 3, 2016 at 7:58 PM, Anthony wrote: > If you mean that request.args(0) contains the name of the restaurant, then > you need a join: > > t = db((db.Menu.Restaurant == db.Restaurant.id) & >(db.Restaurant.name ==

Re: [web2py] Re: wrong record getting selected in recursive select

2016-09-03 Thread Anthony
If you mean that request.args(0) contains the name of the restaurant, then you need a join: t = db((db.Menu.Restaurant == db.Restaurant.id) & (db.Restaurant.name == request.args(0))).select(db.Menu.id).first() Note, in that case, the Menu id will be in t.Menu.id rather than just t.id.

Re: [web2py] Re: wrong record getting selected in recursive select

2016-09-02 Thread brooks lee
I want to select those records in the Menu table such that the name of the restaurant with id in the Menu.restaurant field ==request.args(0).So,what should be the DAL query here? On Fri, Sep 2, 2016 at 6:51 PM, Anthony wrote: > indices=db(db.Menu).select() >> for index in

[web2py] Re: wrong record getting selected in recursive select

2016-09-02 Thread Anthony
> > indices=db(db.Menu).select() > for index in indices: > t=db(index.restaurant.Name > ==request.args[0]).select(db.Menu.ALL).first() > Above, index.restaurant.Name is simply a string value (the name of the restaurant in question), as is request.args(0). Therefore,

Re: [web2py] Re: wrong record getting selected in recursive select

2016-09-01 Thread brooks lee
The extra space before "if t:" must have caused the syntax error.Sorry,my bad.The code with the correct syntax is as follows: #models/db1.py db.define_table('Restaurant', Field('Name',unique=True), ..

[web2py] Re: wrong record getting selected in recursive select

2016-09-01 Thread Dave S
On Thursday, September 1, 2016 at 11:47:55 AM UTC-7, @brooks wrote: > > So my question goes as follows: > #models/db1.py > > db.define_table('Restaurant', > Field('Name',unique=True), > .. >