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 3.8+
- Django 2.2+
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.
Release files for django-daterangefilter 1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_daterangefilter-1.2.tar.gz | 107.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_daterangefilter-1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 218.8 kB
Release files / django_daterangefilter-1.2.tar.gz
| Download URL | django_daterangefilter-1.2.tar.gz |
|---|---|
| Size | 107.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d48bf171d7cdbbe3c87937804b14fa9ad1768613e8bde4cc4a49570faed47bd
|
|
BLAKE2b-256 checksum How to use checksums |
402604b5c80534c5411eda16d77cca4ae516b2ce59ec0bc8c0a00e4d48c9992b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / django_daterangefilter-1.2-py2.py3-none-any.whl
| Download URL | django_daterangefilter-1.2-py2.py3-none-any.whl |
|---|---|
| Size | 111.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
fcb720d3ec1d378383e37e4f82a9543e734995bcd63f5365885c37239fdc0c54
|
|
BLAKE2b-256 checksum How to use checksums |
c73cae4539fecf1eae30278d67badbaa9092a0645c914951e5e8bdf90aaaf0d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|