I have some basic question regarding forming dynamic queries

As an example, lets say my base query is

query = db.orders.id_buyer == auth.user_id

Now I want to form two different queries like

query &= db.orders.status == status.  ===> Should form query1 and want to 
store it for later use

AND

query &= db.orders.order_date <= initial_date. ===> Should form query2 and 
want to store it for later use

I am not able to figure out how to store it in query1 and query2 without 
having to write the base query again intially. Right now, I am solving it 
like below :-

query1 = db.orders.id_buyer == auth.user_id
query1 &= db.orders.status == status

query2 = db.orders.id_buyer == auth.user_id
query2 &= db.orders.order_date <= initial_date

What I want to do ?

query = db.orders.id_buyer == auth.user_id

query1 &= db.orders.status == status AND USE query data, but how?
query2 &= db.orders.order_date <= initial_date AND USE query data, but how?

I hope the problem statement is clear.



-- 
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.

Reply via email to