Skip to main content

Provide a django middleware that take care to persist the querystring in the browser cookies.

Project description

Django Persistent Filters

Django Persistent Filters is a Python package which provide a django middleware that take care to persist the querystring in the browser cookies.

If you have a ListView with a Form for filter the objects, this package is perfect for you!

Installation

Use the package manager pip to install:

pip install django-persistent-filters

Usage

Put the middleware in the settings.py file:

MIDDLEWARE = [
    ...,
    "persistent_filters.middleware.PersistentFiltersMiddleware"
]

Add the urls with a filter form in settings.py file:

PERSISTENT_FILTERS_URLS = [
    # You can use name urls
    reverse_lazy("user:list"),

    # or you can write the path without domain
    "/user/list"
]

Add in the form the button for reset filters:

<button type="submit" name="reset-filters">Reset</button>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-persistent-filters-0.21.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

django_persistent_filters-0.21-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page