You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def filter_queryset(self, queryset):
for name, value in self.form.cleaned_data.items():
queryset = self.filters[name].filter(queryset, value)
return queryset
should be reimplemented into collecting kwargs and submitting them in a single filter() call instead of nesting filter() calls.
The text was updated successfully, but these errors were encountered:
#745 is related. The short answer is that collecting kwargs or Q-objects isn't a workable solution, since it would break many types of filters. e.g., the OrderingFilter or any filter that should exclude instead of filter.
One workaround is to call qs._next_is_sticky() in the loop.
dmugtasimov
changed the title
Multifield filtering on related models does work as expected
Multifield filtering on related models does not work as expected
May 10, 2019
For this filterset:
If both
field1
andfield2
provided it will not work as expected (AND operation) for reasons described here https://docs.djangoproject.com/en/2.2/topics/db/queries/#spanning-multi-valued-relationships and here https://stackoverflow.com/questions/8164675/chaining-multiple-filter-in-django-is-this-a-bug/8164920To fix it this method:
should be reimplemented into collecting kwargs and submitting them in a single
filter()
call instead of nestingfilter()
calls.The text was updated successfully, but these errors were encountered: