Extend SmartFilter to expand search and related search fields

This commit is contained in:
Wayne Witzel III
2017-05-19 16:01:11 -04:00
parent 3cf698d4ae
commit bac1e8b4fe
4 changed files with 67 additions and 15 deletions

View File

@@ -293,12 +293,7 @@ class ListAPIView(generics.ListAPIView, GenericAPIView):
@property
def search_fields(self):
fields = []
for field in self.model._meta.fields:
if field.name in ('username', 'first_name', 'last_name', 'email',
'name', 'description'):
fields.append(field.name)
return fields
return get_search_fields(self.model)
@property
def related_search_fields(self):