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,
DateRangeQuickSelectListFilterBuilder,
)
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()),
("created_at", DateRangeQuickSelectListFilterBuilder()), # Range + QuickSelect Filter
)
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.11.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 844f6cc65492d90ecaa561b2f93eb31c596d2c0d3f70f238f0500aee415f4ad0 |
|
MD5 | 2b565f4caa89e20a4f971aef958aa135 |
|
BLAKE2b-256 | 676bf2d26f62ab0ce3f5eadc40d7ee44bd13b2f36a8bef6384c69cce3ea8f64e |
Close
Hashes for django_admin_rangefilter-0.11.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e66530ca1dc8553a6b20f12219d3d99b48ff9cf987786cd06282154314912ce |
|
MD5 | 813e021ae9d38128fa919da9fef96c82 |
|
BLAKE2b-256 | 294813e03b961416a991f1bf8de1f991bafe1edde4d615797ad3e47040cc7bad |