Debian packaging for django-filter
Go to file
Carlton Gibson a32c777e6f Added tox config file 2015-05-16 21:03:23 +02:00
django_filters Do change notes, bumpversion 2015-05-13 15:13:48 +02:00
docs Do change notes, bumpversion 2015-05-13 15:13:48 +02:00
requirements Added tox config file 2015-05-16 21:03:23 +02:00
tests add test for get_model_field on django 1.8 2015-04-04 12:13:34 +02:00
.bumpversion.cfg Do change notes, bumpversion 2015-05-13 15:13:48 +02:00
.gitignore Added tox config file 2015-05-16 21:03:23 +02:00
.travis.yml Add testing on django 1.8 2015-04-30 16:03:58 -04:00
AUTHORS group filter fields with meta option 'together' 2015-03-17 10:12:29 +00:00
CHANGES.rst Do change notes, bumpversion 2015-05-13 15:13:48 +02:00
LICENSE Small license changes (acknowledge individual contributors). 2012-10-21 09:22:30 +02:00
MANIFEST.in Increased version to 0.7 and updated german translations. 2013-08-10 12:35:09 +02:00
README.rst Adding FieldSet Meta fields Dictionary docs 2014-09-12 14:33:31 -07:00
runshell.py renamed test_django_filters to tests. 2013-03-12 19:38:12 +01:00
runtests.py Fixed warnings in the testsuite. 2014-07-27 12:27:06 +02:00
setup.cfg Fixed support for newer wheel versions. 2013-07-27 12:25:01 +02:00
setup.py Do change notes, bumpversion 2015-05-13 15:13:48 +02:00
tox.ini Added tox config file 2015-05-16 21:03:23 +02:00

README.rst

Django Filter
=============

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

Full documentation on `read the docs`_.

.. image:: https://secure.travis-ci.org/alex/django-filter.png?branch=master
   :target: http://travis-ci.org/alex/django-filter

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`_.

.. _`read the docs`: https://django-filter.readthedocs.org/en/latest/
.. _`mailing list`: http://groups.google.com/group/django-filter