5977862/django-filter — pull request #1 by 5977862 (2014-04-02 08:13:57+00:00)
Title: add custom filter, like clean_XXX in django forms

import django_filters as filters
class UserFilter(filters.FilterSet):
username= filters.DateRangeFilter(label=u"Username")
email= filters.Filter(label=u"e-mail")

class Meta:
model = User
fields = ("username", "email")

def filter_username(self, qs):
username= self.form.cleaned_data["username"]
return qs.filter(username__icontains=username)

def filter_email(self, qs):
email= self.form.cleaned_data["email"]
return qs.filter(email__icontains=email)