class WebTrendsDatasViewSet(viewsets.ModelViewSet):
serializer_class = WebTrendsDatasSerializer
queryset = WebTrendsDatas.objects.all()
filter_backends = [DjangoFilterBackend, filters.SearchFilter, ]
filter_fields = '__all__'
pagination_class = pageset.PagePagination
tags=[__package__]
def list(self, request, *args, **kwargs):
queryset = self.filter_queryset(self.get_queryset())
queryset_page = self.paginate_queryset(queryset)
serializer = self.get_serializer(queryset_page, many=True)
response_data=self.get_paginated_response(serializer.data)
return APIResponse(data=response_data)
笔记 drf重写分页
最新推荐文章于 2024-08-30 18:40:43 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)