Yes. Sorry, that was a typo in my description. I was using request.now.
The problem is that gives a datetime so the datetime would not be equal.
What I've done now is this:
start = parse('%s 00:00:00' % (request.now.strftime('%Y-%m-%d')))
end = parse('%s 23:59:59' % (request.now.strftime('%Y-%m-%d')))
open_workorders = db((db.workorder.siteId.belongs(sites)) &
(db.workorder.completed==None) &
(db.workorder.needed>=start) &
(db.workorder.needed<=end)).select(left=db.site.on(db.workorder.siteId==db.site.siteId),
orderby=db.site.siteNumber)
Not ideal, but it works. Just seems messy. parse is coming from the
python-dateutil package.
-Jim
On Thursday, July 17, 2014 4:42:47 PM UTC-5, 黄祥 wrote:
>
> had you already tried request.now?
> workorders = db(db.workorder.needed == request.now).select()
>
> ref:
> http://web2py.com/books/default/chapter/29/04/the-core#request
>
> best regards,
> stifan
--
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.