对某一个视图类下的视图函数添加过滤
django
class AView(GenericAPIView) # 或者继承GenericViewSet
filter_backends = [SearchFilter]
search_fields = ['name','address']
def get(self,request):
self.filter_queryset(self.get_queryset()) # 即可筛选
return Response()
标签:self,queryset,视图,过滤,类下,添加
From: https://www.cnblogs.com/chunyouqudongwuyuan/p/16854504.html