Skip to main content

Provide a django middleware that take care to persist the querystring in the browser cookies or in the Django session object.

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 or in the Django Request object.

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"
]

If you want to store filters in the session instead Cookies, add in the settings.py file:

PERSISTENT_FILTERS_IN_SESSION = True

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-1.2.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_persistent_filters-1.2-py2.py3-none-any.whl (4.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django_persistent_filters-1.2.tar.gz.

File metadata

  • Download URL: django_persistent_filters-1.2.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.11

File hashes

Hashes for django_persistent_filters-1.2.tar.gz
Algorithm Hash digest
SHA256 ef794f908930ade8caf0fc98fa53cb074aa21d72c7c31f3a15a65d16894cc810
MD5 97a6e6f7f3f0f940212ac9737975ea00
BLAKE2b-256 487ba1a1e662b11d1245b5eb47b44ea622134002146fc9da336f85e075793e86

See more details on using hashes here.

File details

Details for the file django_persistent_filters-1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_persistent_filters-1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e45aaf669c313cae5aa44930a061808a729bf30c63f29e2ac40274ac0873b827
MD5 e6f27308be88693f891608d4a2e59132
BLAKE2b-256 72bf2ba698331a0a1c5ac25714168b22e97879cd95a8f1e41c06ca0f42bf669c

See more details on using hashes here.

Supported by

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