mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Resurrect global .distinct() call (mostly)
This mostly reverts 3c67971e78a12bd94536aa5464f0bc1ea46ba1ee with the minor difference that we only apply this when we're filtering, which is apparently necessary without some notable overhaul since the filtering we're doing will get stuck in as filters, which will generate inner joins, which can result in duplicates if the thing we're joining with is a one to many or many to many, which most things are. With this patch we still need to be generating naturally distinct querysets with any `get_queryset` methods, which will still be much more effecient when filtering is not involved. This fixes #2032 and probably a bunch of other undiscovered issues.
This commit is contained in:
parent
bef61f4003
commit
1abba522b0
@ -219,7 +219,7 @@ class FieldLookupBackend(BaseFilterBackend):
|
||||
else:
|
||||
q = Q(**{k:v})
|
||||
queryset = queryset.filter(q)
|
||||
queryset = queryset.filter(*args)
|
||||
queryset = queryset.filter(*args).distinct()
|
||||
return queryset
|
||||
except (FieldError, FieldDoesNotExist, ValueError), e:
|
||||
raise ParseError(e.args[0])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user