alex/django-filter — pull request #143 by 5977862 (2014-04-03 09:43:10+00:00)
Title: 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)