django-jazzmin-admin-rangefilter app, add the filter by a custom date range on the Django Jazzmin admin UI.
Project description
django-jazzmin-admin-rangefilter
A Django app that adds a filter by date range and numeric range to the Django Jazzmin admin UI.
Requirements
Python 2.7+ or Python 3.6+
Django 1.8+
Installation
Use your favorite Python package manager to install the app from PyPI, e.g.
Example:
pip install django-jazzmin-admin-rangefilter
Add rangefilter to INSTALLED_APPS:
Example:
INSTALLED_APPS = (
...
'rangefilter',
...
)
Example usage
In admin
from django.contrib import admin
from rangefilter.filters import DateRangeFilter, DateTimeRangeFilter, NumericRangeFilter
from .models import Post
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_filter = (
('created_at', DateRangeFilter), ('updated_at', DateTimeRangeFilter),
('num_value', NumericRangeFilter),
)
# If you would like to add a default range filter
# method pattern "get_rangefilter_{field_name}_default"
def get_rangefilter_created_at_default(self, request):
return (datetime.date.today, datetime.date.today)
# If you would like to change a title range filter
# method pattern "get_rangefilter_{field_name}_title"
def get_rangefilter_created_at_title(self, request, field_path):
return 'custom title'
Support Content-Security-Policy
For Django 1.8+, if django-csp is installed, nonces will be added to style and script tags. The setting ADMIN_RANGEFILTER_NONCE_ENABLED controls this behavior.
INSTALLED_APPS = (
...
'rangefilter',
'csp',
...
)
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file django-jazzmin-admin-rangefilter-1.0.0.tar.gz
.
File metadata
- Download URL: django-jazzmin-admin-rangefilter-1.0.0.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 877a9eaffdd5857d0d9ce438669b96a8827e3a2ecfec2522902176fdc7060c79 |
|
MD5 | 939520908f8e468adaed7e59a369de92 |
|
BLAKE2b-256 | 30a228e886cba34355bab66c0a22ca6a80849fbbf9e935e3d09a14a38d31c90e |
File details
Details for the file django_jazzmin_admin_rangefilter-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: django_jazzmin_admin_rangefilter-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 44.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 146e44fece16e842177ad092300dd35bac6008e1b683af8a39e93c3d4709f386 |
|
MD5 | f12f2fe992a241132e616b4cdd96d711 |
|
BLAKE2b-256 | 4b69955f29ffddf5bc04c9f10c2d770bf9a1ca1fc7081b4db709f19fb2b581b3 |