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/actions/workflows/build.yml/badge.svg 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.5.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_rangefilter-0.13.5-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.5.tar.gz.

File metadata

File hashes

Hashes for django_admin_rangefilter-0.13.5.tar.gz
Algorithm Hash digest
SHA256 3134e9e877f59ccad5949cd25cd2db9bf20d170fd8070be584875fdca96d3a14
MD5 2eeb996c0ffbc0be790f848feb68ab61
BLAKE2b-256 c329ca800141c33d2df90eb3306c86f5a8c89c11d2d0493e5c503217f57fb0a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_admin_rangefilter-0.13.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7fdcd1ee9007e2b76a5bd35bc017e785bdc7b17a24b8a36aef4ce80741356c47
MD5 8be1742859f8d0524a9c1f8686142e4d
BLAKE2b-256 bdad577f872dcc0107d608085b626103990028655b797eedab884242b61f6ac0

See more details on using hashes here.

Supported by

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