@@ -38,31 +38,19 @@ def get_schema_fields(self, view):
38
38
39
39
40
40
if django_filters :
41
- from django_filters .filterset import FilterSetMetaclass as DFFilterSetMetaclass
42
41
from django_filters .rest_framework .filterset import FilterSet as DFFilterSet
43
42
44
- class FilterSetMetaclass ( DFFilterSetMetaclass ):
45
- def __new__ ( cls , name , bases , attrs ):
43
+ class FilterSet ( DFFilterSet ):
44
+ def __init__ ( self , * args , ** kwargs ):
46
45
warnings .warn (
47
46
"The built in 'rest_framework.filters.FilterSet' is pending deprecation. "
48
47
"You should use 'django_filters.rest_framework.FilterSet' instead." ,
49
48
PendingDeprecationWarning
50
49
)
51
- return super (FilterSetMetaclass , cls ).__new__ (cls , name , bases , attrs )
52
- _BaseFilterSet = DFFilterSet
50
+ return super (FilterSet , self ).__init__ (* args , ** kwargs )
53
51
else :
54
- # Dummy metaclass just so we can give a user-friendly error message.
55
- class FilterSetMetaclass (type ):
56
- def __init__ (self , name , bases , attrs ):
57
- # Assert only on subclasses, so we can define FilterSet below.
58
- if bases != (object ,):
59
- assert False , 'django-filter must be installed to use the `FilterSet` class'
60
- super (FilterSetMetaclass , self ).__init__ (name , bases , attrs )
61
- _BaseFilterSet = object
62
-
63
-
64
- class FilterSet (six .with_metaclass (FilterSetMetaclass , _BaseFilterSet )):
65
- pass
52
+ def FilterSet ():
53
+ assert False , 'django-filter must be installed to use the `FilterSet` class'
66
54
67
55
68
56
class DjangoFilterBackend (BaseFilterBackend ):
0 commit comments