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.2.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

django_admin_rangefilter-0.13.2-py2.py3-none-any.whl (48.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for django_admin_rangefilter-0.13.2.tar.gz
Algorithm Hash digest
SHA256 12750c32c01d6cc891ba7d05267ce9921527042084da0ac9548a3ae8109f90d3
MD5 d7688f573de3dbc32f88b51fa1659c81
BLAKE2b-256 74897d33a1c6c0d0770feea621439e010a2bb0f3023ec4c938ae582f3a93eb9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_admin_rangefilter-0.13.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 012e4bf28790344db5b63a57b814a3d4ae8f7cd8692854288bd3c396515aa761
MD5 249ce20a0e9011588af8105326d5ba14
BLAKE2b-256 ff499f2656dd47dc7d6e9fbfc967115b1880d49a52325e7390d4630301dff7ce

See more details on using hashes here.

Supported by

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