What does the following say? Entry.objects.filter(pub_date__year=2015)[0].pub_date.month
If it says 7, then its time to delve into the generated SQL for the month query. On Tue, Sep 22, 2015 at 10:52 AM, lxm <[email protected]> wrote: > I create a class named Entry,like this: > >> class Entry(models.Model): > > pub_date = models.DateTimeField() >> > this data table named Entry have one record: > > - pub_date = '2015-7-14 xx:xx:xx' > > then,I excute 'Entry.objects.filter(pub_date__year=2015)' in shell,this > will return right result, > but when I excute 'Entry.objects.filter(pub_date__month=7)',this return > empty list. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/b29a0450-f0c6-421a-be33-770338f5965d%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/b29a0450-f0c6-421a-be33-770338f5965d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. 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/CAB%2BAj0tsYKWaL%2BS_6rwm87BDvcmDLQRg9Zu79hGuXExzo16Khg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

