From 731c63fb0f917e1a3a9317122c98c19633a3a588 Mon Sep 17 00:00:00 2001 From: Adam Dobrawy Date: Tue, 28 Mar 2023 16:43:53 +0200 Subject: [PATCH] Fix tests --- rest_framework/filters.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework/filters.py b/rest_framework/filters.py index 52258f1d2..2f3493841 100644 --- a/rest_framework/filters.py +++ b/rest_framework/filters.py @@ -52,11 +52,11 @@ class SearchFilter(BaseFilterBackend): def get_search_fields(self, view, request): """ - Search fields are obtained from the view / search backend, but the request is + Search fields are obtained from the search backend / view, but the request is always passed to this method. Sub-classes can override this method to dynamically change the search fields based on request content. """ - return getattr(self, 'search_fields', getattr(view, 'search_fields')) + return getattr(self, 'search_fields') or getattr(view, 'search_fields', None) def get_search_terms(self, request): """