Skip to main content

django-admin-rangefilter-jazzmin 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_admin_rangefilter_jazzmin-1.0.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file django_admin_rangefilter_jazzmin-1.0.0.tar.gz.

File metadata

File hashes

Hashes for django_admin_rangefilter_jazzmin-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3f62efd504033b4ca3bf4ae29c499a7b6df9541c5c5de00d6e5fb0c898f2d81c
MD5 1f3a9734d33af511ebe5cb0a772c5907
BLAKE2b-256 08f3f71d2a76826df654578f1971c9770c16701b761aedeb1ce0cd09f91857b9

See more details on using hashes here.

File details

Details for the file django_admin_rangefilter_jazzmin-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_rangefilter_jazzmin-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4df810eba7135a6a1645ce8b9f2ac5db4959b982467490d00fa1e86a2dbf671
MD5 e00e4683979979b6a8c4f62e4f1a8d4b
BLAKE2b-256 d26f14c6fd21f342203f4ea22758ec15670153388e2c72eace1d65f3b1511ed8

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