This commit is contained in:
javad committed 2024-01-22 13:01:42 +03:30
commit 89a5d70512
284 files changed
+8364

No files matched your search

+1
View File
@@ -0,0 +1 @@
from .custom_pagination_style_1 import CustomPagination
@@ -0,0 +1,16 @@
from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response
class CustomPagination(PageNumberPagination):
def get_paginated_response(self, data):
return Response({
'links': {
'next': self.get_next_link(),
'next_page': self.page.next_page_number() if self.page.has_next() else None,
'previous': self.get_previous_link(),
'previous_page': self.page.previous_page_number() if self.page.has_previous() else None
},
'count': self.page.paginator.count,
'results': data
})