Skip to content

Commit f067fd3

Browse files
authored
Fix future conflict with Filter.bind (#344)
1 parent 93e7b13 commit f067fd3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

rest_framework_filters/filters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, filterset, *args, lookups=None, **kwargs):
5959
self.filterset = filterset
6060
self.lookups = lookups or []
6161

62-
def bind(self, bind_cls):
62+
def bind_filterset(self, filterset):
6363
"""
6464
Bind a filterset class to the filter instance. This class is used for
6565
relative imports. Only the first bound class is used as filterset
@@ -68,8 +68,8 @@ def bind(self, bind_cls):
6868
This is also necessary to allow `.filterset` to be resolved during
6969
FilterSet class creation time, instead of during initialization.
7070
"""
71-
if not hasattr(self, 'bind_cls'):
72-
self.bind_cls = bind_cls
71+
if not hasattr(self, 'bound_filterset'):
72+
self.bound_filterset = filterset
7373

7474
def filterset():
7575
def fget(self):
@@ -79,7 +79,7 @@ def fget(self):
7979
self._filterset = import_string(self._filterset)
8080
except ImportError:
8181
# Fallback to building import path relative to bind class
82-
path = '.'.join([self.bind_cls.__module__, self._filterset])
82+
path = '.'.join([self.bound_filterset.__module__, self._filterset])
8383
self._filterset = import_string(path)
8484
return self._filterset
8585

rest_framework_filters/filterset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __new__(cls, name, bases, attrs):
2929

3030
# See: :meth:`rest_framework_filters.filters.RelatedFilter.bind`
3131
for name, f in new_class.related_filters.items():
32-
f.bind(new_class)
32+
f.bind_filterset(new_class)
3333

3434
# Only expand when model is defined. Model may be undefined for mixins.
3535
if new_class._meta.model is not None:

0 commit comments

Comments
 (0)