Take the 2-minute tour ×

[Edit: sorry, my mistake - I was improperly converting the list to HTML before outputting it, so it appeared empty. This question is invalid]

I'm having trouble querying a datetime field in a django-nonrel application.

I have a "Page" model with a "last_scan_time" field. I've simplified my problem down to the following:

time = Page.objects.all()[0].last_scan_time
result1 = Page.objects.get(last_scan_time=time)
result2 = Page.objects.filter(last_scan_time=time)

result1 contains the first page, as expected. However result2 is an empty list.

If I try the same queries from "manage.py shell", it works as expected (result2 is a list containing the first page).

I really can't see what I'm doing wrong here, any help would be much appreciated!

share|improve this question
Can you show your Page model structure... Also what is your django version? –  FallenAngel Aug 6 '11 at 11:31
And some output that shows that result2 is actually empty. –  Daniel Roseman Aug 6 '11 at 11:35
add comment


Your Answer



Browse other questions tagged or ask your own question.