Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
 
PREVIOUS NEXT
Tagged: #paginate #APIView #drf
ADD COMMENT
Topic
Name
3+6 =