I'm trying to use django_filter's DateFilter to filter by an exact date, but could not get it to return any result.
myapp/models.py
from django.db import models
class Event(models.Model):
start = models.DateField()
title = models.CharField(_'title'), max_length=256)
myapp/filters.py
from myapp.models import Event
import django_filters
class EventFilter(django_filters.FilterSet):
start = django_filters.DateFilter(
'start', label=_('With start date'),
widget=forms.DateInput() # I'm using a datepicker-like widget to enter date
)
class Meta:
model = Event
fields = ('start',)
For example: I have an event with start date 01/14/2012. When I entered that value in the date filter, it returns nothing.
I wasn't able to find a more in-depth description about DateFilter in django_filter's documentation site, either in its filter reference or Using django-filter guide. Or anywhere in general. Any ideas what I might be doing wrong?
I don't expect there's anything wrong with the date format from the datepicker widget since it's being used in another form (to enter data) and it works fine.
Additional info: I'm using django-1.6 and whatever the last version of django-filter