https://github.com/f213/django-suit-daterange-filter
Filter for django-admin allowing lookups by date range
https://github.com/f213/django-suit-daterange-filter
django django-admin django-suit filter python python-3
Last synced: 17 days ago
JSON representation
Filter for django-admin allowing lookups by date range
- Host: GitHub
- URL: https://github.com/f213/django-suit-daterange-filter
- Owner: f213
- License: mit
- Created: 2016-09-15T18:50:29.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-06-24T13:40:46.000Z (about 5 years ago)
- Last Synced: 2025-06-24T12:23:48.940Z (21 days ago)
- Topics: django, django-admin, django-suit, filter, python, python-3
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 18
- Watchers: 1
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Date range filter for django-admin
[](https://travis-ci.org/f213/django-suit-daterange-filter)
[](https://codecov.io/gh/f213/django-suit-daterange-filter)
[](https://badge.fury.io/py/django-suit-daterange-filter)Yet another filter for Django admin interface, adding possibility to lookup by date range. The filter is only compatible with [django-suit](https://github.com/darklow/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## Installation
```sh
pip install django-suit-daterange-filter
```Then add to the `settings.INSTALLED_APPS`:
```python
INSTALLED_APPS = (
...
'date_range_filter',
)
```## Usage
```python
# admin.pyfrom date_range_filter import DateRangeFilter
class EggAdmin(admin.ModelAdmin):
list_filters = (
'is_spam',
'egg_count',
('timestamp', DateRangeFilter),
)```
## Issues
If you get JS errors about gettext, you should include django's built in i18n javascript, like this:
```python
class EggAdmin(admin.ModelAdmin):
...
class Media:
js = ['/admin/jsi18n/']
```This module is heavily inspired by [django-daterange-filter](https://github.com/tzulberti/django-datefilterspec).