Re: Entry.objects.filter(pub_date__month=7) doesn't work with Django 1.8

2015-09-22 Thread Bill Freeman
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  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 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/b29a0450-f0c6-421a-be33-770338f5965d%40googlegroups.com
> 
> .
> 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 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/CAB%2BAj0tsYKWaL%2BS_6rwm87BDvcmDLQRg9Zu79hGuXExzo16Khg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Entry.objects.filter(pub_date__month=7) doesn't work with Django 1.8

2015-09-22 Thread lxm
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 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/b29a0450-f0c6-421a-be33-770338f5965d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.