Found the issue.
The 'start'
field is a DateTimeField. So when querying only for the date, no match is found because it never matches the time.
For example:
If I enter 01/14/2012, it looks for start date datetime.date(2012, 01, 14, 0, 0)
, but the actual start date may be datetime.datetime(2012, 01, 14, 21, 0, tzinfo=<UTC>)
.
Solution:
Use lookup_type='startswith'
or 'lookup_type='contains'
(source) but 'contains'
appears to be faster
Class EventFilter(django_filters.FilterSet):
start = django_filters.DateFilter(
'start', label=_('With start date'),
lookup_type='contains' # use contains
)
...