django-filter


Namedjango-filter JSON
Version 24.3 PyPI version JSON
download
home_pageNone
SummaryDjango-filter is a reusable Django application for allowing users to filter querysets dynamically.
upload_time2024-08-02 13:27:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Django Filter
=============

Django-filter is a reusable Django application allowing users to declaratively
add dynamic ``QuerySet`` filtering from URL parameters.

Full documentation on `read the docs`_.

.. image:: https://raw.githubusercontent.com/carltongibson/django-filter/python-coverage-comment-action-data/badge.svg
    :target: https://github.com/carltongibson/django-filter/tree/python-coverage-comment-action-data

.. image:: https://badge.fury.io/py/django-filter.svg
    :target: http://badge.fury.io/py/django-filter


Versioning and stability policy
-------------------------------

Django-Filter is a mature and stable package. It uses a two-part CalVer
versioning scheme, such as ``21.1``. The first number is the year. The second
is the release number within that year.

On an on-going basis, Django-Filter aims to support all current Django
versions, the matching current Python versions, and the latest version of
Django REST Framework.

Please see:

* `Status of supported Python versions <https://devguide.python.org/versions/#supported-versions>`_
* `List of supported Django versions <https://www.djangoproject.com/download/#supported-versions>`_

Support for Python and Django versions will be dropped when they reach
end-of-life. Support for Python versions will be dropped when they reach
end-of-life, even when still supported by a current version of Django.

Other breaking changes are rare. Where required, every effort will be made to
apply a "Year plus two" deprecation period. For example, a change initially
introduced in ``23.x`` would offer a fallback where feasible and finally be
removed in ``25.1``. Where fallbacks are not feasible, breaking changes without
deprecation will be called out in the release notes.


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

Install using pip:

.. code-block:: sh

    pip install django-filter

Then add ``'django_filters'`` to your ``INSTALLED_APPS``.

.. code-block:: python

    INSTALLED_APPS = [
        ...
        'django_filters',
    ]


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})


Usage with Django REST Framework
--------------------------------

Django-filter provides a custom ``FilterSet`` and filter backend for use with
Django REST Framework.

To use this adjust your import to use
``django_filters.rest_framework.FilterSet``.

.. code-block:: python

    from django_filters import rest_framework as filters

    class ProductFilter(filters.FilterSet):
        class Meta:
            model = Product
            fields = ('category', 'in_stock')


For more details see the `DRF integration docs`_.


Support
-------

If you need help you can start a `discussion`_. For commercial support, please
`contact Carlton Gibson via his website <https://noumenal.es/>`_.

.. _`discussion`: https://github.com/carltongibson/django-filter/discussions
.. _`read the docs`: https://django-filter.readthedocs.io/en/main/
.. _`DRF integration docs`: https://django-filter.readthedocs.io/en/stable/guide/rest_framework.html

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-filter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Carlton Gibson <carlton.gibson@noumenal.es>",
    "keywords": null,
    "author": null,
    "author_email": "Alex Gaynor <alex.gaynor@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/50/bc/dc19ae39c235332926dd0efe0951f663fa1a9fc6be8430737ff7fd566b20/django_filter-24.3.tar.gz",
    "platform": null,
    "description": "Django Filter\n=============\n\nDjango-filter is a reusable Django application allowing users to declaratively\nadd dynamic ``QuerySet`` filtering from URL parameters.\n\nFull documentation on `read the docs`_.\n\n.. image:: https://raw.githubusercontent.com/carltongibson/django-filter/python-coverage-comment-action-data/badge.svg\n    :target: https://github.com/carltongibson/django-filter/tree/python-coverage-comment-action-data\n\n.. image:: https://badge.fury.io/py/django-filter.svg\n    :target: http://badge.fury.io/py/django-filter\n\n\nVersioning and stability policy\n-------------------------------\n\nDjango-Filter is a mature and stable package. It uses a two-part CalVer\nversioning scheme, such as ``21.1``. The first number is the year. The second\nis the release number within that year.\n\nOn an on-going basis, Django-Filter aims to support all current Django\nversions, the matching current Python versions, and the latest version of\nDjango REST Framework.\n\nPlease see:\n\n* `Status of supported Python versions <https://devguide.python.org/versions/#supported-versions>`_\n* `List of supported Django versions <https://www.djangoproject.com/download/#supported-versions>`_\n\nSupport for Python and Django versions will be dropped when they reach\nend-of-life. Support for Python versions will be dropped when they reach\nend-of-life, even when still supported by a current version of Django.\n\nOther breaking changes are rare. Where required, every effort will be made to\napply a \"Year plus two\" deprecation period. For example, a change initially\nintroduced in ``23.x`` would offer a fallback where feasible and finally be\nremoved in ``25.1``. Where fallbacks are not feasible, breaking changes without\ndeprecation will be called out in the release notes.\n\n\nInstallation\n------------\n\nInstall using pip:\n\n.. code-block:: sh\n\n    pip install django-filter\n\nThen add ``'django_filters'`` to your ``INSTALLED_APPS``.\n\n.. code-block:: python\n\n    INSTALLED_APPS = [\n        ...\n        'django_filters',\n    ]\n\n\nUsage\n-----\n\nDjango-filter can be used for generating interfaces similar to the Django\nadmin's ``list_filter`` interface.  It has an API very similar to Django's\n``ModelForms``.  For example, if you had a Product model you could have a\nfilterset for it with the code:\n\n.. code-block:: python\n\n    import django_filters\n\n    class ProductFilter(django_filters.FilterSet):\n        class Meta:\n            model = Product\n            fields = ['name', 'price', 'manufacturer']\n\n\nAnd then in your view you could do:\n\n.. code-block:: python\n\n    def product_list(request):\n        filter = ProductFilter(request.GET, queryset=Product.objects.all())\n        return render(request, 'my_app/template.html', {'filter': filter})\n\n\nUsage with Django REST Framework\n--------------------------------\n\nDjango-filter provides a custom ``FilterSet`` and filter backend for use with\nDjango REST Framework.\n\nTo use this adjust your import to use\n``django_filters.rest_framework.FilterSet``.\n\n.. code-block:: python\n\n    from django_filters import rest_framework as filters\n\n    class ProductFilter(filters.FilterSet):\n        class Meta:\n            model = Product\n            fields = ('category', 'in_stock')\n\n\nFor more details see the `DRF integration docs`_.\n\n\nSupport\n-------\n\nIf you need help you can start a `discussion`_. For commercial support, please\n`contact Carlton Gibson via his website <https://noumenal.es/>`_.\n\n.. _`discussion`: https://github.com/carltongibson/django-filter/discussions\n.. _`read the docs`: https://django-filter.readthedocs.io/en/main/\n.. _`DRF integration docs`: https://django-filter.readthedocs.io/en/stable/guide/rest_framework.html\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Django-filter is a reusable Django application for allowing users to filter querysets dynamically.",
    "version": "24.3",
    "project_urls": {
        "Bug Tracker": "https://github.com/carltongibson/django-filter/issues",
        "Changelog": "https://github.com/carltongibson/django-filter/blob/main/CHANGES.rst",
        "Documentation": "https://django-filter.readthedocs.io/en/main/",
        "Homepage": "https://github.com/carltongibson/django-filter/tree/main",
        "Source Code": "https://github.com/carltongibson/django-filter"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "09b192f1c30b47c1ebf510c35a2ccad9448f73437e5891bbd2b4febe357cc3de",
                "md5": "2db7a2274c8c33547d618596ebf3aae4",
                "sha256": "c4852822928ce17fb699bcfccd644b3574f1a2d80aeb2b4ff4f16b02dd49dc64"
            },
            "downloads": -1,
            "filename": "django_filter-24.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2db7a2274c8c33547d618596ebf3aae4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 95011,
            "upload_time": "2024-08-02T13:27:55",
            "upload_time_iso_8601": "2024-08-02T13:27:55.616939Z",
            "url": "https://files.pythonhosted.org/packages/09/b1/92f1c30b47c1ebf510c35a2ccad9448f73437e5891bbd2b4febe357cc3de/django_filter-24.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "50bcdc19ae39c235332926dd0efe0951f663fa1a9fc6be8430737ff7fd566b20",
                "md5": "311acaee883d9a63aaa740dfae17cbd2",
                "sha256": "d8ccaf6732afd21ca0542f6733b11591030fa98669f8d15599b358e24a2cd9c3"
            },
            "downloads": -1,
            "filename": "django_filter-24.3.tar.gz",
            "has_sig": false,
            "md5_digest": "311acaee883d9a63aaa740dfae17cbd2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 144444,
            "upload_time": "2024-08-02T13:27:58",
            "upload_time_iso_8601": "2024-08-02T13:27:58.132645Z",
            "url": "https://files.pythonhosted.org/packages/50/bc/dc19ae39c235332926dd0efe0951f663fa1a9fc6be8430737ff7fd566b20/django_filter-24.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-02 13:27:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "carltongibson",
    "github_project": "django-filter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-filter"
}
        
Elapsed time: 0.40184s