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 3.6+
Django 1.11+
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.
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
File details
Details for the file django_admin_rangefilter-0.13.2.tar.gz
.
File metadata
- Download URL: django_admin_rangefilter-0.13.2.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12750c32c01d6cc891ba7d05267ce9921527042084da0ac9548a3ae8109f90d3 |
|
MD5 | d7688f573de3dbc32f88b51fa1659c81 |
|
BLAKE2b-256 | 74897d33a1c6c0d0770feea621439e010a2bb0f3023ec4c938ae582f3a93eb9f |
File details
Details for the file django_admin_rangefilter-0.13.2-py2.py3-none-any.whl
.
File metadata
- Download URL: django_admin_rangefilter-0.13.2-py2.py3-none-any.whl
- Upload date:
- Size: 48.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 012e4bf28790344db5b63a57b814a3d4ae8f7cd8692854288bd3c396515aa761 |
|
MD5 | 249ce20a0e9011588af8105326d5ba14 |
|
BLAKE2b-256 | ff499f2656dd47dc7d6e9fbfc967115b1880d49a52325e7390d4630301dff7ce |