drf default pagination
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 100
}
drf default pagination
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 100
}
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)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us