django-admin-rangefilter app, add the filter by a custom date range on the admin UI.
Project description
django-admin-rangefilter
A Django app that adds a filter by date range and numeric range to the admin UI.
Requirements
Python 2.7+ or Python 3.6+
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 datetime import datetime
from django.contrib import admin
from rangefilter.filters import DateRangeFilterBuilder, DateTimeRangeFilterBuilder, NumericRangeFilterBuilder
from .models import Post
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_filter = (
("created_at", DateRangeFilterBuilder()),
(
"updated_at",
DateTimeRangeFilterBuilder(
title="Custom title",
default_start=datetime(2020, 1, 1),
default_end=datetime(2030, 1, 1),
),
),
("num_value", NumericRangeFilterBuilder()),
)
Support Content-Security-Policy
For Django 1.8+, if django-csp is installed, nonces will be added to style and script tags. The setting ADMIN_RANGEFILTER_NONCE_ENABLED controls this behavior.
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.10.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f5b84308b9aa673b47b7626b65bf3a0c5ac08ee20e06983225f748d61689d36 |
|
MD5 | 94f22c9ed8f30229979a7254f97292bb |
|
BLAKE2b-256 | 9821553bc10df5fc7483ca7e614caf4b1456fb972dab8bfd7a14b5ae256b3e37 |
Close
Hashes for django_admin_rangefilter-0.10.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43fb3ea287e37bb786751f0e869d040e1cb75b867ff3886e3e40c80d8d040a0f |
|
MD5 | 88f52855c4eb9e9d96807b1c7b89f835 |
|
BLAKE2b-256 | 164bd434a0eb409a4e36b91c150dd72762dc977b9912d0334f6212c2eae3484e |