mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-24 10:34:03 +03:00
apply review comments
This commit is contained in:
parent
c2921b1eca
commit
a82e23c0ff
|
@ -196,7 +196,7 @@ When in use, the browsable API will include a `SearchFilter` control:
|
|||
|
||||
![Search Filter](../img/search-filter.png)
|
||||
|
||||
The `SearchFilter` class will only be applied if the view or `SearchFilter` class itself has a `search_fields` attribute set. The `search_fields` attribute should be a list of names of text type fields on the model, such as `CharField` or `TextField`.
|
||||
The `SearchFilter` class will only be applied if `SearchFilter` class itself or the view has a `search_fields` attribute set. The `search_fields` attribute should be a list of names of text type fields on the model, such as `CharField` or `TextField`.
|
||||
|
||||
from rest_framework import filters
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class SearchFilter(BaseFilterBackend):
|
|||
always passed to this method. Sub-classes can override this method to
|
||||
dynamically change the search fields based on request content.
|
||||
"""
|
||||
return getattr(view, 'search_fields', getattr(self, 'search_fields'))
|
||||
return getattr(self, 'search_fields', getattr(view, 'search_fields'))
|
||||
|
||||
def get_search_terms(self, request):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user