django restframework search_filter使用空格搜索内容

时间:2019-07-27 10:31:14

标签: django django-rest-framework

喜欢数据

[
  {"data": '{"line": "10", "no": "10"}' }, # I want to get this one, but return these two
  {"data": '{"line": "110", "no": "10"}' }
]

使用search_filter过滤器data字段,搜索"line": "10",在后端,搜索词将按空格分隔,并在上方返回两个记录。

# rest_framework.filters.SearchFilter#filter_queryset

search_terms = {list} <class 'list'>: ['"line":', '"10"']
 0 = {str} '"line":'
 1 = {str} '"10"'

我想搜索整个单词,该怎么做?

0 个答案:

没有答案