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. Your templates can either this this template as a parent:
{% extends "admin/daterange/change_list.html" %}
or, copy the extrastyle and extrahead blocks from this template to your own.
In your ModelAdmin, for each filter 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"]
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.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f05d20e30da5d8141e55f4d808ca66d66a3df0b8515944726fe263cbdfe1c12 |
|
MD5 | 7c7205a75397277495827e9537d1af9d |
|
BLAKE2b-256 | fed19faba2f81c3926b3e89a74d5edd481e3cc94d04d4a0fdc3e487441ef570f |
Hashes for django_daterange_filterspec-2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f70bcc515beca840243f07609e2b14506816aea831b9e2879c90c7b8ea7105c4 |
|
MD5 | 662ab88f6945b73ab24341caf8f95859 |
|
BLAKE2b-256 | ca63c65d67dde46be0d9e815276cdd2521f07c6311cea102447ed8e480ca28a2 |