paginate on APIView drf
class NameOfView(APIView):
def get(self, request):
paginator = CustomPagination()
queryset = Model.objects.all()
paginate_queryset = paginator.paginate_queryset(queryset, request)
serialize_pagination = SerializerClass(paginate_queryset, many=True).data
data = paginator.get_paginated_response(serialize_pagination).data
return Response(data)
Are there any code examples left?
New code examples in category Other