Yet another filter for Django admin interface, adding possibility to lookup by date range. The filter is only compatible with django-suit (does anyone use ugly stock admin now?).
Key features:
- Support both DateField and DateTimeField
- User timezone support
- Simplest ever (< 128 SLOC)
- Well tested
- Python 3.6 and 2.7 support
pip install django-suit-daterange-filter
Then add to the settings.INSTALLED_APPS
:
INSTALLED_APPS = (
...
'date_range_filter',
)
# admin.py
from date_range_filter import DateRangeFilter
class EggAdmin(admin.ModelAdmin):
list_filters = (
'is_spam',
'egg_count',
('timestamp', DateRangeFilter),
)
If you get JS errors about gettext, you should include django's built in i18n javascript, like this:
class EggAdmin(admin.ModelAdmin):
...
class Media:
js = ['/admin/jsi18n/']
This module is heavily inspired by django-daterange-filter.