Metadata-Version: 2.4
Name: django-filters-mixin
Version: 0.2.0
Summary: Simple integration between django-filter and Django pagination.
Author-email: Basil Shubin <basil.shubin@gmail.com>
License-Expression: BSD-3-Clause
Project-URL: download, https://github.com/bashu/django-filters-mixin/zipball/master
Project-URL: homepage, https://github.com/bashu/django-filters-mixin/
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: django>=5.2
Requires-Dist: django-filter>0.15
Dynamic: license-file

django-filters-mixin
====================

.. image:: https://badge.fury.io/py/django-filters-mixin.svg
    :target: https://badge.fury.io/py/django-filters-mixin

.. image:: https://img.shields.io/pypi/pyversions/django-filters-mixin.svg
    :target: https://pypi.python.org/pypi/django-filters-mixin/

.. image:: https://img.shields.io/pypi/djversions/django-filters-mixin.svg
    :target: https://pypi.python.org/pypi/django-filters-mixin/

.. image:: https://github.com/bashu/django-filters-mixin/actions/workflows/test.yml/badge.svg
    :target: https://github.com/bashu/django-filters-mixin/actions/workflows/test.yml

Simple integration between django-filter_ and pagination_.

Maintained by `Basil Shubin <https://github.com/bashu/>`_, and some great
`contributors <https://github.com/bashu/django-filters-mixin/contributors>`_.

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

You must have *django-filter* installed and configured, see the
django-filter_ documentation for details and setup instructions.

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

First install the module, preferably in a virtual environment. It can be installed from PyPI:

.. code-block:: shell

    pip install django-filters-mixin

Usage
-----

The ``FilterMixin`` allows to use pagination together with filtering:
the ``page`` query parameter is removed from the data passed to the
filterset, so it is never treated as a filter value.

.. code-block:: python

    # views.py

    import django_filters
    from django_filters.views import FilterView

    from filters.views import FilterMixin


    class CustomFilterSet(django_filters.FilterSet):
        # read https://django-filter.readthedocs.io/en/stable/guide/usage.html
        ...


    class CustomFilterView(FilterMixin, FilterView):
        filterset_class = CustomFilterSet
        paginate_by = 12
        ...

Please see the ``example`` application. This application is used to
manually test the functionalities of this package. This also serves as
a good example.

Testing
-------

The test suite uses `pytest <https://pytest.org/>`_ and
`pytest-django <https://pytest-django.readthedocs.io/>`_, and runs entirely
against an in-memory SQLite database - no external database setup is
required::

    $ uv run --group dev pytest

For testing against the full matrix of supported Python and Django versions,
install tox (``pip install tox``) and run ``tox`` from the source checkout::

    $ tox

Contributing
------------

If you've found a bug, implemented a feature or customized the template and
think it is useful then please consider contributing. Patches, pull requests or
just suggestions are welcome!

License
-------

``django-filters-mixin`` is released under the BSD license.

.. _django-filter: https://github.com/carltongibson/django-filter
.. _pagination: https://docs.djangoproject.com/en/stable/topics/pagination/

Changes
-------

0.2.0 (2026-11-10)
~~~~~~~~~~~~~~~~~~

* Now requires Python 3.11+ and Django 5.2+. Python 2 and older Django
  versions are no longer supported.
* Removed ``filters.__version__``; use
  ``importlib.metadata.version("django-filters-mixin")`` instead.
* Migrated packaging to ``pyproject.toml``, added a pytest test suite,
  pre-commit hooks and GitHub Actions CI/release workflows.
* Updated the ``example`` project to work with current Django versions.

0.1.4 (2016-10-14)
~~~~~~~~~~~~~~~~~~

* Updated to Django 1.10.x.
