DRF pagination issue in APIView

Question:

I want to implement LimitOffsetPagination in my APIView which was successful but the url is required to be appended with ?limit=<int>.

Something like this:

enter image description here

But I do not want to manually add that endpoint.

So I tried creating a new pagination.py file:

enter image description here

But now I am not getting the pagination prompt for navigation to next post like before.
I think return needs to be altered?

Asked By: Kalpesh

||

Answers:

You just need to change your return. Instead of return Response(serializer.data) use return paginator.get_paginated_response(serializer.data)

Answered By: Divya Prakash