Date range filter for Django admin fixed for django 4.x
Project description
Django admin date range filter
Application adds three Django admin list filters: DateRangeFilter
, PastDateRangeFilter
and FutureDateRangeFilter
. These filters let user filter models by date range. PastDateRangeFilter
and FutureDateRangeFilter
add quick selection of predefined date ranges. Filters can be applied to any model date fields. Application supports default Django admin theme and Suit theme.
Requirements
- Python 2.7+ or Python 3.3+
- Django 1.9+
Installation
Install django-daterangefilter
using pip:
pip install django-daterangefilter
Add daterangefilter
to INSTALLED_APPS
. Example:
INSTALLED_APPS = (
...
'daterangefilter',
...
)
Application uses static files so do not forget to issue collectstatic
management command in production environment.
Example usage
in admin.py:
from django.contrib import admin
from daterangefilter.filters import PastDateRangeFilter, FutureDateRangeFilter
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_filter = [
('created_at', PastDateRangeFilter), ('publish_at', FutureDateRangeFilter)
]
Advanced usage
Predefined ranges can be completely redefined by overriding _past_ranges.html
and _future_ranges.html
templates.
Take into account that these templates are inserted in the middle of the javascript code and may contain nothing but ranges
definition. For more examples on using moment
library refer to library documentation.
Credits
Filter widget uses a great JavaScript date range picker component - Date Range Picker by Dan Grossman.
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-daterangefilter-fixed-1.1.0.tar.gz
.
File metadata
- Download URL: django-daterangefilter-fixed-1.1.0.tar.gz
- Upload date:
- Size: 107.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8350d7e1cc04473c87f4293dc337132ff0e6b2336e59ce66655cbca99aed4ba4 |
|
MD5 | 9dfc2c51482562e38c278732945c82b6 |
|
BLAKE2b-256 | 60ce0b67119125bd2a7b3ed0d9fb2dfe80c9e5feb30f0c212df4107637850093 |
File details
Details for the file django_daterangefilter_fixed-1.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: django_daterangefilter_fixed-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 111.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13b3f71b8661e6a586d531bb36a0db113cccf35c78c8abc54d89fc202e6d949e |
|
MD5 | dc94562197134fc6b6fc38e2464252c5 |
|
BLAKE2b-256 | c8c06f708d33776a78c48c0157364e0926f2ca6dc00d191c3a304d6d4a9fcbe3 |