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 ==
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.
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
>
> 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,
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),
..
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),
> ..
>
6 matches
Mail list logo