Skip to content

Instantly share code, notes, and snippets.

@johnboxall
Created May 10, 2010 21:01
Show Gist options
  • Save johnboxall/396540 to your computer and use it in GitHub Desktop.
Save johnboxall/396540 to your computer and use it in GitHub Desktop.
from django import forms
import django_filters
class DateRangeField(django_filters.fields.RangeField):
# Django-Filter DateRangeFilter that really accepts a range of dates ;)
def __init__(self, *args, **kwargs):
fields = (
forms.DateField(),
forms.DateField(),
)
forms.MultiValueField.__init__(self, fields, *args, **kwargs)
class DateRangeFilter(django_filters.RangeFilter):
field_class = DateRangeField
@edmcdonagh
Copy link

Hi John

What licence does this code have please?

Thanks, Ed

@carltongibson
Copy link

Hi John. This looks like is should be part of Django Filter. Would you be happy to contribute it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment