A DateRange Filter for Django Admin Changelists
Project description
Adds a form with AdminDateWidgets that can be used to select a range of dates for filtering the list of records displayed in an admin Changelist.
Quick start
Install the package from PyPI:
pip install django-daterange-filterspec
The package includes a template, which loads Django’s calendar widget and date shortcuts. Add the package to the INSTALLED_APPS setting so the template loader can find it:
INSTALLED_APPS = ( ... "daterange.apps.DateRangeFilterConfig", ... )
In your ModelAdmin, set the template used for the changelist to the one provided by the package. Then, for each field you want to filter on create a tuple with the name of the field and the DateRangeFilter filter class:
from django.contrib import admin from daterange.filters import DateRangeFilter from .models import Article @admin.register(Article) class ArticleAdmin(admin.ModelAdmin): list_display = ["title", "slug", "published"] list_filter = [("published", DateRangeFilter)] ordering = ["-created"] change_list_template = "admin/daterange/change_list.html"
Now, go forth and filter!
Project
If you check out the project from the repository there is a fully functioning Django site that you can use to see the filter in action.
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
Hashes for django-daterange-filterspec-2.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf08ab96934974be502df95aed9ed8aa77818d1cd105d0447c3c7934851f8db |
|
MD5 | a927d349d45c06c7170c9a94b246cd81 |
|
BLAKE2b-256 | 123dfc1301b84159c72f88c5625e66bfac473077721bdf106b45b770e12dc2e5 |
Hashes for django_daterange_filterspec-2.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fda029c2cc93a83875e6578a205b3080763541cb9460ee618f3d419c9026f8b |
|
MD5 | c44d4c4161d42cf4bef07acf32888b2e |
|
BLAKE2b-256 | b95cc1c3ba3ee17d5e543e036d5d21b89c8730b8627fd05131683d7a42634e01 |