mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 08:59:54 +03:00
Fix SearchFilter annotation+m2m distinct
This commit is contained in:
parent
24098b4d48
commit
07617848e5
|
@ -86,7 +86,7 @@ class SearchFilter(BaseFilterBackend):
|
||||||
search_field = search_field[1:]
|
search_field = search_field[1:]
|
||||||
# Annotated fields do not need to be distinct
|
# Annotated fields do not need to be distinct
|
||||||
if isinstance(queryset, models.QuerySet) and search_field in queryset.query.annotations:
|
if isinstance(queryset, models.QuerySet) and search_field in queryset.query.annotations:
|
||||||
return False
|
continue
|
||||||
parts = search_field.split(LOOKUP_SEP)
|
parts = search_field.split(LOOKUP_SEP)
|
||||||
for part in parts:
|
for part in parts:
|
||||||
field = opts.get_field(part)
|
field = opts.get_field(part)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user