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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef794f908930ade8caf0fc98fa53cb074aa21d72c7c31f3a15a65d16894cc810
|
|
| MD5 |
97a6e6f7f3f0f940212ac9737975ea00
|
|
| BLAKE2b-256 |
487ba1a1e662b11d1245b5eb47b44ea622134002146fc9da336f85e075793e86
|
File details
Details for the file django_persistent_filters-1.2-py2.py3-none-any.whl.
File metadata
- Download URL: django_persistent_filters-1.2-py2.py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e45aaf669c313cae5aa44930a061808a729bf30c63f29e2ac40274ac0873b827
|
|
| MD5 |
e6f27308be88693f891608d4a2e59132
|
|
| BLAKE2b-256 |
72bf2ba698331a0a1c5ac25714168b22e97879cd95a8f1e41c06ca0f42bf669c
|