Skip to main content

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

Project description

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

django-jazzmin-admin-rangefilter

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

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

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-jazzmin-admin-rangefilter

Add rangefilter to INSTALLED_APPS:

Example:

INSTALLED_APPS = (
    ...
    'rangefilter',
    ...
)

Example usage

In admin

from django.contrib import admin
from rangefilter.filters import DateRangeFilter, DateTimeRangeFilter, NumericRangeFilter

from .models import Post


@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
    list_filter = (
        ('created_at', DateRangeFilter), ('updated_at', DateTimeRangeFilter),
        ('num_value', NumericRangeFilter),
    )

    # If you would like to add a default range filter
    # method pattern "get_rangefilter_{field_name}_default"
    def get_rangefilter_created_at_default(self, request):
        return (datetime.date.today, datetime.date.today)

    # If you would like to change a title range filter
    # method pattern "get_rangefilter_{field_name}_title"
    def get_rangefilter_created_at_title(self, request, field_path):
        return 'custom title'

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


Download files

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

Source Distribution

django-jazzmin-admin-rangefilter-1.0.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

django_jazzmin_admin_rangefilter-1.0.0-py2.py3-none-any.whl (44.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-jazzmin-admin-rangefilter-1.0.0.tar.gz.

File metadata

File hashes

Hashes for django-jazzmin-admin-rangefilter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 877a9eaffdd5857d0d9ce438669b96a8827e3a2ecfec2522902176fdc7060c79
MD5 939520908f8e468adaed7e59a369de92
BLAKE2b-256 30a228e886cba34355bab66c0a22ca6a80849fbbf9e935e3d09a14a38d31c90e

See more details on using hashes here.

File details

Details for the file django_jazzmin_admin_rangefilter-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_jazzmin_admin_rangefilter-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 146e44fece16e842177ad092300dd35bac6008e1b683af8a39e93c3d4709f386
MD5 f12f2fe992a241132e616b4cdd96d711
BLAKE2b-256 4b69955f29ffddf5bc04c9f10c2d770bf9a1ca1fc7081b4db709f19fb2b581b3

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