We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ac705d commit 08d518dCopy full SHA for 08d518d
rest_framework_filters/filterset.py
@@ -115,9 +115,13 @@ def expand_filters(self):
115
116
# include exclusion keys
117
if exclude_name in self.data:
118
- f = copy.deepcopy(f)
119
- f.exclude = not f.exclude
120
- requested_filters[exclude_name] = f
+ # deepcopy the *base* filter to prevent copying of model & parent
+ f_copy = copy.deepcopy(self.base_filters[filter_name])
+ f_copy.parent = f.parent
121
+ f_copy.model = f.model
122
+ f_copy.exclude = not f.exclude
123
+
124
+ requested_filters[exclude_name] = f_copy
125
126
# include filters from related subsets
127
if isinstance(f, filters.RelatedFilter) and filter_name in related_data:
0 commit comments