Fix DjangoFilterBackend mro

This commit is contained in:
Ryan P Kilby 2017-05-03 12:51:44 -04:00
parent 53b100d03d
commit 01ffb8961d

View File

@ -50,12 +50,17 @@ if django_filters:
DeprecationWarning DeprecationWarning
) )
return super(FilterSet, self).__init__(*args, **kwargs) return super(FilterSet, self).__init__(*args, **kwargs)
DFBase = django_filters.rest_framework.DjangoFilterBackend
else: else:
def FilterSet(): def FilterSet():
assert False, 'django-filter must be installed to use the `FilterSet` class' assert False, 'django-filter must be installed to use the `FilterSet` class'
DFBase = BaseFilterBackend
class DjangoFilterBackend(BaseFilterBackend):
class DjangoFilterBackend(DFBase):
""" """
A filter backend that uses django-filter. A filter backend that uses django-filter.
""" """
@ -69,9 +74,7 @@ class DjangoFilterBackend(BaseFilterBackend):
DeprecationWarning DeprecationWarning
) )
from django_filters.rest_framework import DjangoFilterBackend return super(DjangoFilterBackend, cls).__new__(cls, *args, **kwargs)
return DjangoFilterBackend(*args, **kwargs)
class SearchFilter(BaseFilterBackend): class SearchFilter(BaseFilterBackend):