I have used both syntaxes. I have no strong preferences.
On Jul 28, 11:02 am, pbreit wrote:
> What was the final answer on creating compound queries like this:
>
> db(db.requests.product==db.products.id)(db.products.id==3).select()
>
> Is that acceptable or advisable? Or is the & way preferred?
I just do what the book says and it works; so I use the binary and
operator between terms. Also you can split it across lines. Since I
use descriptive (meaning too long) table and field names, it's helpful
to be able to split.
On Jul 28, 12:02 pm, pbreit wrote:
> What was the final answer on cr
What was the final answer on creating compound queries like this:
db(db.requests.product==db.products.id)(db.products.id==3).select()
Is that acceptable or advisable? Or is the & way preferred? The & way has
the benefit of being splittable across lines?
Also, I think Field('product', db.product
If you're just fetching a single request at a time, you can also do a
recursive select (see
http://web2py.com/book/default/chapter/06#Recursive-selects):
request = db(db.requests.id==3).select().first()
description = request.product.description
This is inefficient for multiple records (requ
Antonio, check out these references:
http://www.web2py.com/book/default/chapter/06#Logical-Operators
http://www.web2py.com/book/default/chapter/06#One-to-Many-Relation
http://www.web2py.com/book/default/chapter/06#Many-to-Many
Assuming 'db.requests.product' is a foreign key to your products
table
5 matches
Mail list logo