{"id":3963,"library":"django-admin-rangefilter","title":"django-admin-rangefilter","description":"django-admin-rangefilter is a Django application that enhances the admin UI by adding custom date, datetime, and numeric range filters. It is currently at version 0.13.5 and maintains an active release cadence, frequently updating for Django compatibility and bug fixes.","status":"active","version":"0.13.5","language":"en","source_language":"en","source_url":"https://github.com/silentsokolov/django-admin-rangefilter","tags":["django","admin","filter","date-range","datetime-range","numeric-range","ui-enhancement"],"install":[{"cmd":"pip install django-admin-rangefilter","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"This is a Django admin application and requires Django to function.","package":"Django","optional":false}],"imports":[{"symbol":"DateRangeFilter","correct":"from rangefilter.filters import DateRangeFilter"},{"symbol":"DateTimeRangeFilter","correct":"from rangefilter.filters import DateTimeRangeFilter"},{"symbol":"NumericRangeFilter","correct":"from rangefilter.filters import NumericRangeFilter"}],"quickstart":{"code":"# settings.py\nINSTALLED_APPS = [\n    # ...\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    # ...\n    'rangefilter',\n    # ...\n]\n\n# models.py (example)\nfrom django.db import models\nclass MyModel(models.Model):\n    name = models.CharField(max_length=100)\n    created_at = models.DateField(auto_now_add=True)\n    updated_at = models.DateTimeField(auto_now=True)\n    price = models.DecimalField(max_digits=10, decimal_places=2, default=0.00)\n    def __str__(self):\n        return self.name\n\n# admin.py\nfrom django.contrib import admin\nfrom rangefilter.filters import DateRangeFilter, DateTimeRangeFilter, NumericRangeFilter\nfrom .models import MyModel\n\n@admin.register(MyModel)\nclass MyModelAdmin(admin.ModelAdmin):\n    list_display = ('name', 'created_at', 'updated_at', 'price')\n    list_filter = (\n        ('created_at', DateRangeFilter),\n        ('updated_at', DateTimeRangeFilter),\n        ('price', NumericRangeFilter),\n        # Add 'collapsible=True' for Django >= 4.1:\n        # ('created_at', {'filter_class': DateRangeFilter, 'collapsible': True}),\n    )\n","lang":"python","description":"First, add 'rangefilter' to your `INSTALLED_APPS` in `settings.py`. Then, in your `admin.py`, import the desired filter classes (e.g., `DateRangeFilter`, `DateTimeRangeFilter`, `NumericRangeFilter`) and apply them to fields in your `ModelAdmin`'s `list_filter` attribute. For date/datetime fields, simply specify the field name and filter class. For numeric fields, specify the field name and `NumericRangeFilter`."},"warnings":[{"fix":"Review any custom `rangefilter` templates for compatibility with changes introduced in v0.13.0, especially if targeting Django 4.1+ for collapsible filters.","message":"Version 0.13.0 introduced a change to the default range template and added support for collapsible filters (Django >= 4.1). If you have custom templates overriding `rangefilter/date_filter.html` or similar, they might require adjustments to work with this new version and take advantage of new features.","severity":"breaking","affected_versions":"0.13.0+"},{"fix":"Ensure 'rangefilter' is present in your `INSTALLED_APPS` list in `settings.py`.","message":"It's a common mistake to forget adding 'rangefilter' to your `INSTALLED_APPS` in `settings.py`. Without this, the custom filters will not be registered correctly and will not appear in the admin interface.","severity":"gotcha","affected_versions":"All"},{"fix":"Upgrade to version 0.13.3 or newer to resolve the filter clearing issue.","message":"Prior to version 0.13.3, there was a bug that prevented users from clearing filters properly. This could lead to confusing UX where applied filters could not be reset.","severity":"gotcha","affected_versions":"<0.13.3"},{"fix":"Only apply `collapsible=True` in `list_filter` for Django projects running version 4.1 or higher. Example: `('created_at', {'filter_class': DateRangeFilter, 'collapsible': True})`","message":"The `collapsible` filter option, introduced in v0.13.0, is only supported for Django versions 4.1 and higher. Attempting to use it with older Django versions will not have the desired effect and might lead to unexpected rendering.","severity":"gotcha","affected_versions":"0.13.0+"},{"fix":"Upgrade to version 0.12.2 or newer to ensure correct microsecond handling in `DateTimeRangeFilter`.","message":"In versions prior to 0.12.2 (specifically fixed in 0.12.1 and 0.12.2), `DateTimeRangeFilter` might have incorrectly handled microsecond precision for upper time bounds, potentially excluding valid entries or providing incorrect range filtering for `DateTimeField`s.","severity":"gotcha","affected_versions":"<0.12.2"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}