From 9e8b6f124767a876d114d7350df26812fc6065d6 Mon Sep 17 00:00:00 2001 From: Fabio Sangiovanni Date: Wed, 12 Jun 2024 10:11:20 +0200 Subject: [PATCH] jet/filters: fix compat with django-admin-rangefilter >= 0.12.0 --- docs/filters.rst | 4 ++-- jet/filters.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/filters.rst b/docs/filters.rst index 7553a9dee..92bb932ea 100644 --- a/docs/filters.rst +++ b/docs/filters.rst @@ -11,11 +11,11 @@ django-admin-rangefilter ------------------------ In order to fix compatibility issues with ``django-admin-rangefilter`` package you should use JET's admin filter class -``jet.filters.DateRangeFilter`` instead of ``rangefilter.filter.DateRangeFilter``. +``jet.filters.DateRangeFilter`` instead of ``rangefilter.filters.DateRangeFilter``. .. code:: python - #from rangefilter.filter import DateRangeFilter + #from rangefilter.filters import DateRangeFilter from jet.filters import DateRangeFilter diff --git a/jet/filters.py b/jet/filters.py index d13a5ae30..25962bebe 100644 --- a/jet/filters.py +++ b/jet/filters.py @@ -43,7 +43,10 @@ def field_choices(self, field, request, model_admin): try: from django import forms - from rangefilter.filter import DateRangeFilter as OriginalDateRangeFilter + try: + from rangefilter.filter import DateRangeFilter as OriginalDateRangeFilter + except ImportError: + from rangefilter.filters import DateRangeFilter as OriginalDateRangeFilter class DateRangeFilter(OriginalDateRangeFilter):