Filtering records based on date months

10 views
Skip to first unread message

Chris Norman

unread,
Oct 14, 2015, 10:24:49 AM10/14/15
to django...@googlegroups.com
Hi all,
I have written a Journey model, which has an out and a back field, both
of which are datetime fields.

What I want to do is something like:

from datetime import datetime
now = datetime.now()
for journey in Journey.objects.filter(out__month = now.month, out__day =
now.day):
print journey

This returns an empty list though.

Am I doing something wrong?

Thanks,

Reply all
Reply to author
Forward
0 new messages