Allow to filter by a custom date range on the Django Admin
Project description
Add the option to filter by a custom date range on the admin. This allows to inputs to be used to get the custom date range filters.
See datefilter.png of a screenshot of how this is seen on the admin.
IMPORTANT: this will work with Django 1.4. I won’t work with previous Django versions.
Installation
Use pip/easy_install
pip install django-daterange-filter
Add daterange_filter to settings.INSTALLED_APP. For this, edit the setup.py file:
INSTALLED_APPS = (
...
'daterange_filter'
)
After this, if you have a model like this one:
class MyModel(models.Model):
...
foo = models.CharField(max_length=1, choices=BAR_CHOICES)
created_at = models.DateField()
To allow to filter the created_at field using the date ranges, you must edit the admin.ModelAdmin referenced to that class:
from daterange_filter.filter import DateRangeFilter
from django.contrib import admin
from models import MyModel
class MyModelAdmin(admin.ModelAdmin):
list_filter = (
'foo',
('created', DateRangeFilter), # this is a tuple
...
)
DateRangeFilter honours localization and supports local date formats for filtering.
Changes
1.1.1:
Special thanks to: https://github.com/mightygraf
0.2.0:
Updated README
Works with DateTime (special thanks to Andrea Rabbaglietti)
0.1.1:
Removed the custom DateRangeField
Improved i18n
Special thanks to: https://github.com/DXist
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
File details
Details for the file django-daterange-filter-1.1.1.tar.gz
.
File metadata
- Download URL: django-daterange-filter-1.1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff6d02786007b7f5d415984734b2337994ee6f6a63e1bfa2183f3a1def06f8c1 |
|
MD5 | 72a013539f13232600cd748907c995d8 |
|
BLAKE2b-256 | 94fbcd73e30eb8afedea5466607e742fa032e73eb58c0a168eed97d55b76d021 |