-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Description
class BlogIndexListViewSet(viewsets.GenericViewSet, mixins.ListModelMixin):
queryset = Blog.objects.all()
serializer_class = BlogSerializer
pagination_class = StandardResultsSetPagination
filter_backends = (DjangoFilterBackend, SearchFilter)
filter_class = BlogFilter
search_fields = ('@title', '@content', 'tags__name','category__name')
django.core.exceptions.FieldError: Unsupported lookup 'search' for CharField or join on the field not permitted.
官方doc中提到
The search behavior may be restricted by prepending various characters to the search_fields.
'^' Starts-with search.
'=' Exact matches.
'@' Full-text search. (Currently only supported Django's MySQL backend.)
'$' Regex search.
For example:
search_fields = ('=username', '=email')
我把字段改成TextField也不行,数据库用的mysql,全文搜索是不是不支持?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels