Debian packaging for django-filter
Go to file
Benjamin Dauvergne 383d63beda add debian packaging 2017-04-06 16:33:36 +02:00
debian add debian packaging 2017-04-06 16:33:36 +02:00
django_filters Update CHANGES and version for 1.0.1 release 2016-11-28 15:51:22 +01:00
docs Update CHANGES and version for 1.0.1 release 2016-11-28 15:51:22 +01:00
requirements Add coreapi to ci, fix test reqs 2016-10-16 19:06:46 -04:00
tests Add failing test for lazy text 2016-11-12 03:58:26 -05:00
.bumpversion.cfg Update CHANGES and version for 1.0.1 release 2016-11-28 15:51:22 +01:00
.gitignore Added tox config file 2015-05-16 21:03:23 +02:00
.travis.yml Install coverage on Travis 2016-11-02 21:33:59 +01:00
AUTHORS group filter fields with meta option 'together' 2015-03-17 10:12:29 +00:00
CHANGES.rst Update CHANGES and version for 1.0.1 release 2016-11-28 15:51:22 +01:00
LICENSE Small license changes (acknowledge individual contributors). 2012-10-21 09:22:30 +02:00
MANIFEST.in Prepare for 0.13 release 2016-03-11 20:38:25 +01:00
Makefile Update docs on `filter_overrides` usage 2016-11-18 09:13:57 +01:00
README.rst Develop update (#574) 2016-11-28 15:46:51 +01:00
runshell.py Fix runshell sync behavior 2016-04-12 12:35:54 -04:00
runtests.py Consolidate shell/test settings, replace syncdb w/ migrate 2015-11-23 03:06:24 -05:00
setup.cfg Fixed support for newer wheel versions. 2013-07-27 12:25:01 +02:00
setup.py Update CHANGES and version for 1.0.1 release 2016-11-28 15:51:22 +01:00
tox.ini Update DRF to 3.4/3.5, add warnings build 2016-11-08 13:50:40 -05: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://travis-ci.org/carltongibson/django-filter.svg?branch=master
    :target: https://travis-ci.org/carltongibson/django-filter

Requirements
------------

* **Python**: 2.7, 3.3, 3.4, 3.5
* **Django**: 1.8, 1.9, 1.10
* **DRF**: 3.4, 3.5

Installation
------------

Install using pip:

.. code-block:: sh

    pip install django-filter

Or clone the repo and add to your ``PYTHONPATH``:

.. code-block:: sh

    git clone git@github.com:carltongibson/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:

.. code-block:: python

    import django_filters

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


And then in your view you could do:

.. code-block:: python

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

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

.. code-block:: python

    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.io/en/develop/
.. _`mailing list`: http://groups.google.com/group/django-filter