mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 21:14:01 +03:00
Merge pull request #3324 from Rikuoja/master
Don't error on missing `search_fields` attribute.
This commit is contained in:
commit
1ba879278a
|
@ -102,15 +102,16 @@ class SearchFilter(BaseFilterBackend):
|
||||||
def filter_queryset(self, request, queryset, view):
|
def filter_queryset(self, request, queryset, view):
|
||||||
search_fields = getattr(view, 'search_fields', None)
|
search_fields = getattr(view, 'search_fields', None)
|
||||||
|
|
||||||
orm_lookups = [
|
|
||||||
self.construct_search(six.text_type(search_field))
|
|
||||||
for search_field in search_fields
|
|
||||||
]
|
|
||||||
search_terms = self.get_search_terms(request)
|
search_terms = self.get_search_terms(request)
|
||||||
|
|
||||||
if not search_fields or not search_terms:
|
if not search_fields or not search_terms:
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
orm_lookups = [
|
||||||
|
self.construct_search(six.text_type(search_field))
|
||||||
|
for search_field in search_fields
|
||||||
|
]
|
||||||
|
|
||||||
base = queryset
|
base = queryset
|
||||||
for search_term in search_terms:
|
for search_term in search_terms:
|
||||||
queries = [
|
queries = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user