Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 28 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-24T13:40:46.000Z (over 4 years ago)
- Last Synced: 2024-10-07T19:11:35.254Z (about 1 month ago)
- Topics: django, django-admin, django-suit, filter, python, python-3
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 18
- Watchers: 2
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Date range filter for django-admin
[![Build Status](https://travis-ci.org/f213/django-suit-daterange-filter.svg?branch=master)](https://travis-ci.org/f213/django-suit-daterange-filter)
[![codecov](https://codecov.io/gh/f213/django-suit-daterange-filter/branch/master/graph/badge.svg)](https://codecov.io/gh/f213/django-suit-daterange-filter)
[![PyPI version](https://badge.fury.io/py/django-suit-daterange-filter.svg)](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?).
![django-suit-daterange-filter](https://cloud.githubusercontent.com/assets/1592663/23668937/af6d1b54-0373-11e7-8ed2-3e4dcb9b3b54.png)
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).