mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 12:17:24 +03:00
no need to do distinct on every loop cycle & add analogue of distinct for oracle users
This commit is contained in:
parent
7813d2fb35
commit
c47ec60ea2
|
@ -106,9 +106,12 @@ class SearchFilter(BaseFilterBackend):
|
|||
or_queries = [models.Q(**{orm_lookup: search_term})
|
||||
for orm_lookup in orm_lookups]
|
||||
queryset = queryset.filter(reduce(operator.or_, or_queries))
|
||||
if settings.DATABASES[queryset.db]["ENGINE"] != "django.db.backends.oracle":
|
||||
queryset = queryset.distinct()
|
||||
|
||||
if settings.DATABASES[queryset.db]["ENGINE"] != "django.db.backends.oracle":
|
||||
queryset = queryset.distinct()
|
||||
else:
|
||||
pk_list = queryset.values_list('pk', flat=True)
|
||||
queryset = view.model.objects.filter(pk__in=set(pk_list))
|
||||
return queryset
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user