如何在django-rest-framework中使用SearchFilter?

时间:2015-12-30 03:13:19

标签: python django django-rest-framework

我想用django-rest-framework
做一个搜索功能 这就是我所做的:
views.py:
我补充一点:

queryset = Site.objects.all()
serializer_class = SiteSerializer
filter_backends = (filters.SearchFilter,)
search_fields = ('name',)  

但是,当我访问htttp:127.0.0.1/api/v3/vgroup/?search=bob时,它会给我这个错误:
enter image description here

0 个答案:

没有答案