Skip to content

Commit

Permalink
Merge pull request #11 from djungle-io/fix-django-admin-rangefilter-c…
Browse files Browse the repository at this point in the history
…ompat

jet/filters: fix compat with django-admin-rangefilter >= 0.12.0
  • Loading branch information
sangiovannidev authored Jun 12, 2024
2 parents 9d8982a + 9e8b6f1 commit 571a782
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion jet/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 571a782

Please sign in to comment.