Created
May 29, 2021 15:21
-
-
Save walison17/ec170445e574f085ba0e96a4888c3051 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework.pagination import PageNumberPagination | |
class CustomPageNumberPagination(PageNumberPagination): | |
def get_paginated_response(self, data): | |
return Response({ | |
'count': self.page.paginator.count, | |
'current_page': self.page.number, | |
'next': self.get_next_link(), | |
'previous': self.get_previous_link(), | |
'results': data | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment