0

How to add pagination here ? using django pagination



class UserListView(APIView):
    @method_decorator(admin_decorator())
    def post(self, request):
        try:
            controller = UserListController(data=request.data)
            return Response(status=status.HTTP_200_OK, data=controller.get_data())
        except Exception as e:
            print(e)
            return Response({"message": "Internal Server Error"}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
  • Why is your data being served by a POST request? Is this the only method on the view? – Iain Shelvington Dec 21 '21 at 06:52
  • yes ,, I am trying fetch data through api , but now need pagination over here ,, because of list is being too long ,, after adding more user .. – VIKASH KUMAR Dec 21 '21 at 06:59
  • check this https://stackoverflow.com/questions/31785966/django-rest-framework-turn-on-pagination-on-a-viewset-like-modelviewset-pagina – Thirumaran Dec 22 '21 at 07:25

0 Answers0