django-filter 0.8

Django-filter is a reusable Django application for allowing users to filter querysets dynamically.

Django-filter is a reusable Django application for allowing users to filter querysets dynamically.

Full documentation on read the docs.

Requirements

  • Python 2.6+
  • Django 1.4.5+

Installation

Install using pip:

pip install django-filter

Or clone the repo and add to your PYTHONPATH:

git clone git@github.com:alex/django-filter.git

Usage

Django-filter can be used for generating interfaces similar to the Django admin's list_filter interface. It has an API very similar to Django's ModelForms. For example, if you had a Product model you could have a filterset for it with the code:

import django_filters

class ProductFilter(django_filters.FilterSet):
    class Meta:
        model = Product
        fields = ['name', 'price', 'manufacturer']

And then in your view you could do:

def product_list(request):
    filter = ProductFilter(request.GET, queryset=Product.objects.all())
    return render_to_response('my_app/template.html', {'filter': filter})

Django-filters additionally supports specifying FilterSet fields using a dictionary to specify filters with lookup types:

import django_filters

class ProductFilter(django_filters.FilterSet):
    class Meta:
        model = Product
        fields = {'name': ['exact', 'icontains'],
                  'price': ['exact', 'gte', 'lte'],
                 }

The filters will be available as 'name', 'name__icontains', 'price', 'price__gte', and 'price__lte' in the above example.

Support

If you have questions about usage or development you can join the mailing list.

BSD

Author

Alex Gaynor

Pip

django-filter==0.8

Classifiers

  • Programming Language :: Python :: 3.4
  • Programming Language :: Python :: 3.3
  • Programming Language :: Python :: 3.2
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python :: 2.6
  • Programming Language :: Python
  • Operating System :: OS Independent
  • License :: OSI Approved :: BSD License
  • Intended Audience :: Developers
  • Framework :: Django
  • Environment :: Web Environment
  • Development Status :: 5 - Production/Stable
File Type Python Version Uploaded On Downloads
django-filter-0.8.tar.gz Source Sept. 29, 2014 23,792
Version Release Date
0.8 Sept. 29, 2014
0.7 Aug. 10, 2013
0.6 March 25, 2013
0.6a1 March 12, 2013
0.5.4 Nov. 16, 2012
0.5.3 March 10, 2010
0.5.2 Nov. 30, 2009
0.5.1 Aug. 25, 2009
0.5.0 Aug. 14, 2009
0.2.0 June 19, 2009
0.1.0 May 8, 2009
Date Package Version Action
Nov. 4, 2014, 1:12 p.m. django-filter 0.5.3 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.5.2 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.5.1 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.5.0 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.6a1 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.5.4 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.2.0 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.1.0 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.6 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.7 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter 0.8 Release Created
Nov. 4, 2014, 1:12 p.m. django-filter Package Created