Hello,

I'm playing around with the 1.9 beta release. The __date field lookup 
(casts DateTimeField to a date) is a very useful new addition. However, it 
doesn't seem to work in a custom QuerySet.

models.py

class EntryQuerySet(models.QuerySet):
def today(self):
         today = now().date()
         return self.filter(start__date=today) [start is a DateTimeField]

In Django shell:

>>> WorkSession.objects.today()

...

django.core.exceptions.FieldError: Unsupported lookup 'date' for 
DateTimeField or join on the field not permitted.

Changing "__date=today" to "__year=2015" produces the expected results. If 
this is a bug, I'll attach the full traceback and models.py.

Adam


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cfed7044-1bae-4df1-9573-8fbac9d14e0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to