mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 01:57:00 +03:00
fix empty and_query
This commit is contained in:
parent
de95598a1e
commit
0906bf2c08
|
@ -107,11 +107,13 @@ class SearchFilter(BaseFilterBackend):
|
|||
for orm_lookup in orm_lookups]
|
||||
and_queries.append(reduce(operator.or_, or_queries))
|
||||
|
||||
if and_queries:
|
||||
if settings.DATABASES[queryset.db]["ENGINE"] == "django.db.backends.oracle":
|
||||
pk_list = queryset.filter(reduce(operator.and_, and_queries)).values_list('pk', flat=True)
|
||||
return queryset.filter(pk__in=frozenset(pk_list))
|
||||
else:
|
||||
return queryset.filter(reduce(operator.and_, and_queries)).distinct()
|
||||
return queryset
|
||||
|
||||
|
||||
class OrderingFilter(BaseFilterBackend):
|
||||
|
|
Loading…
Reference in New Issue
Block a user