1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

fix a bug that causes __search filters to not properly call .distinct()

This commit is contained in:
Ryan Petrello 2020-01-23 13:36:27 -05:00
parent c35c80b06c
commit 256404ba03
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -283,6 +283,9 @@ class FieldLookupBackend(BaseFilterBackend):
search_value, new_keys, _ = self.value_to_python(queryset.model, key, force_text(value))
assert isinstance(new_keys, list)
search_filters[search_value] = new_keys
# by definition, search *only* joins across relations,
# so it _always_ needs a .distinct()
needs_distinct = True
continue
# Custom chain__ and or__ filters, mutually exclusive (both can