Skip to main content

django-admin-rangefilter app, add the filter by a custom date range on the admin UI.

Project description

https://github.com/silentsokolov/django-admin-rangefilter/workflows/build/badge.svg?branch=master https://codecov.io/gh/silentsokolov/django-admin-rangefilter/branch/master/graph/badge.svg

django-admin-rangefilter

A Django app that adds a filter by date range and numeric range to the admin UI.

https://raw.githubusercontent.com/silentsokolov/django-admin-rangefilter/master/docs/images/screenshot.png

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_rangefilter-0.13.3.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

django_admin_rangefilter-0.13.3-py2.py3-none-any.whl (48.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django_admin_rangefilter-0.13.3.tar.gz.

File metadata

File hashes

Hashes for django_admin_rangefilter-0.13.3.tar.gz
Algorithm Hash digest
SHA256 8151b840753ea2c4de9963b1904cbbe7e786b7bc04de5dbd64567c86d287bbe8
MD5 303c3dce07a4b89a5a0a642416e3a721
BLAKE2b-256 8abde05a9356f1ed15d1496ff901c33f9b9f354d154941d2366f961cd1530820

See more details on using hashes here.

File details

Details for the file django_admin_rangefilter-0.13.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_rangefilter-0.13.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a776b1de5c5c153ed167e11fe757f138380207b2295a44d29d939c6ded76463a
MD5 7b25e352fc0a497dad483399e6a62f74
BLAKE2b-256 6aa5fec346d1b793001c3a57947f643bfa174da667f0a8375ac59c8127243c8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page