I'd like to filter objects to the day with datetime, but can't find examples on how to do this anywhere.
This, for example, works perfectly in pulling together all following events:
@login_required
def invoice_picker(request):
"""Grab a date from the URL and show all the invoicable deliveries for that day."""
query = request.GET.get('q' , '2/9/1984')
date = datetime
date = datetime.strptime('7/14/2010', '%m/%d/%Y')
date = date.strptime(query, '%m/%d/%Y')
results = []
if query:
results = LaundryDelivery.objects.filter(end__gte=date)
return render_to_response('invoicer.html', {
'results' : results,
'date' : date,
'user' : request.user,
})
But when I remove __gte, it returns nothing because the dates are along the lines of 2010-06-22 04:04:00 instead of 2010-06-22 00:00:00. I also tried:
results = LaundryDelivery.objects.filter(end.date=date)
but unfortunately I get the error "keyword can't be an expression". Any ideas?