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),
> ..................................................
> .......................auth.signature,format='%(Name)s')
>
> db.define_table('Menu',
> Field('menu','upload'),
> Field('restaurant','reference Restaurant',writable=False))
>
>
> ############controller/func()
> indices=db(db.Menu).select()
> for index in indices:
> t=db(index.restaurant.Name
> ==request.args[0]).select(db.Menu.ALL).first()
> if t:
> record=db.Menu(t.id)
> form=SQLFORM(db.Menu,record).process()
> ......................................................................
> .....................................................................
>
> (I have one record in the Menu table now)
> The question is that the first record gets selected even if the condition
> is not true.I do not understand it.Please tell me what I am doing wrong.Any
> help is appreciated.
>
> Regards,
> Brooks
>
I dunno, but I get a syntax error trying to translate your for ... select
into something I can try with -S and my tables. Is db(<ROW object>)
meaningful?
/dps
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.