yes, "start_date" is the date field.

shabda, I want to filter by the month attribute of a date field and it
works for exact match. In a filter, a date field's year, month and day
attributes can be used like filter(start_date__month=1).

I think filter(start_date__month__in=[1, 2, 3]) format should be
supported. I will submit it as a feature request to trac.




On Jan 22, 2:58 am, Bram - Smartelectronix <[EMAIL PROTECTED]>
wrote:
> omat wrote:
> > Hi all,
>
> > I have a model with a date field. When I try to filter based on its
> > months like:
>
> > q1 = Event.objects.filter(start_date__month__in=[1, 2, 3])
>
> > I get an "unable to resolve field 'start_date__month'" error.
>
> > Is this usage not supported or is this a bug?
>
> afaik this isn't supported (I'm assuming start_date is a date field)
>
> you could use
>
> http://www.djangoproject.com/documentation/db-api/#extra-select-none-...
>
>   - bram
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to