Skip to main content
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 to the admin UI.

https://raw.githubusercontent.com/silentsokolov/django-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-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

from .models import Post


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

    # 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',
    ...
)

Metadata

Release files for django-rangefilter 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-rangefilter 0.9.1
File Size Uploaded
django-rangefilter-0.9.1.tar.gz 24.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-rangefilter 0.9.1
File Interpreter ABI Platform
django_rangefilter-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 76.9 kB

Release files / django-rangefilter-0.9.1.tar.gz

Download URL django-rangefilter-0.9.1.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a7c716407f5baa02aadc6ae8423c1ae8d5ef9a9d428c6889745df50ea3649bda
BLAKE2b-256 checksum
How to use checksums
07d01b863d7a1e10072726a42a03fb04b1794ae7f674c3e23504a5aab78e4289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release files / django_rangefilter-0.9.1-py3-none-any.whl

Download URL django_rangefilter-0.9.1-py3-none-any.whl
Size 52.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c056bb713f69af7739ad0823a101a889182ee3676594eacf061b6e47dfcc12c
BLAKE2b-256 checksum
How to use checksums
26d2fabef4f7257e0e3b0d02a40b2bfbda935b5f9d75015bd077eadbe3ed1851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page