django-admin-rangefilter app, add the filter by a custom date range on the admin UI.
Project description
django-admin-rangefilter
django-admin-rangefilter app, add the filter by a custom date / datetime range on the admin UI.
Requirements
Python 2.7+ or Python 3.4+
Django 1.8+
Installation
Use your favorite Python package manager to install the app from PyPI, e.g.
Example:
pip install django-admin-rangefilter
Add rangefilter to INSTALLED_APPS:
Example:
INSTALLED_APPS = (
...
'rangefilter',
...
)
Example usage
In admin
from django.contrib import admin
from rangefilter.filter import DateRangeFilter, DateTimeRangeFilter
from .models import Post
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_filter = (
('created_at', DateRangeFilter), ('updated_at', DateTimeRangeFilter),
)
# If you would like to add a default range filter
# method pattern "get_rangefilter_{field_name}_default"
def get_rangefilter_created_at_default(self, request):
return (datetime.date.today, datetime.date.today)
# If you would like to change a title range filter
# method pattern "get_rangefilter_{field_name}_title"
def get_rangefilter_created_at_title(self, request, field_path):
return 'custom title'
Support Content-Security-Policy
For Django 1.8+, if django-csp is installed, nonces will be added to style and script tags.
INSTALLED_APPS = (
...
'rangefilter',
'csp',
...
)
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
Built Distribution
Close
Hashes for django-admin-rangefilter-0.7.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | da641c8fb919a570f26d3008250f54f86e6446c47eab0d3e8454a1253ffeb6b5 |
|
MD5 | 7207195f5cc5a6bd7e82ccf928456821 |
|
BLAKE2b-256 | 94ebcd08cc627c6e6c4d33a73ea8f3049ee3a9cd565315e9d4d84f534f4d5284 |
Close
Hashes for django_admin_rangefilter-0.7.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95343502a9d7725f51708cdc54185c156936b28566a3c004d4cb46dd9b6a3317 |
|
MD5 | 42e53720d0df016144cc8e5f44ae0930 |
|
BLAKE2b-256 | 5bba1416e65e744a0b46d3181cf35b08bcf0a9f411472f868375be49920a4d5e |