Skip to content

Andr3iC/django-range-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-range-filter

A quick but imperfect implementation of range filter in django admin.

Acknowledgements

The initial version is adapted from djaong-datefilterspec written by Tomas Zulberti, see https://github.com/tzulberti/django-datefilterspec

Installation

Add range_filter to settings.INSTALLED_APP:

INSTALLED_APPS = (
    ...
    'range_filter'
)

After this, if you have a model like this one:

class MyModel(models.Model):
    ...
    score = models.DecimalField()
    created = models.DateField()

To allow to filter the fields by range, you must edit the corresponding admin.ModelAdmin like this:

from daterange_filter.filter import DateRangeFilter, DecimalRnageFilter
from django.contrib import admin
from models import MyModel

class MyModelAdmin(admin.ModelAdmin):
    list_filter = (
        ('score', DecimalRangeFilter),
        ('created', DateRangeFilter),
        ...
    )

About

Range filters for Django admin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published