Multiple search by m2m always empty #8313
Unanswered
Gorb-onk
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Because of queryset.filter(reduce(operator.and_, conditions)) in filter_queryset method of SearchFilter when we use search by m2m field with 2 or more search temrs its produce query like
WHERE ....
AND UPPER("table_field"."name"::text) LIKE UPPER(TERM1%)
AND UPPER("table_field"."name"::text) LIKE UPPER(TERM2%)
Thats why result queryset is always empty
It can be fixed by replacing usage operator.and_ with queryset.filter
Beta Was this translation helpful? Give feedback.
All reactions