Hello

I want to get "today" orders of my user and I'm using relationship
like:

import datetime
def now():
    return datetime.datetime.now()
def time_from():
    return datetime.datetime(now().year, now().month, now().day)
def time_to():
    return time_from() + datetime.timedelta(1)


mapper(User, users_table,
        properties={'today_orders': relationship(Orders, primaryjoin =
 
and_(orders_table.c.cashier_id==users_table.c.id,
                       and_(orders_table.c.created>time_from(),
orders_table.c.created<time_to()))
                              ),
)

code works, but now() in my __init__ takes always the day of paster
start date (when model have been initialized)

What I'm doing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to