14 lines
423 B
Python
14 lines
423 B
Python
|
from rest_framework import pagination
|
||
|
from rest_framework.response import Response
|
||
|
|
||
|
|
||
|
class PagePaginationWithPageCount(pagination.PageNumberPagination):
|
||
|
|
||
|
def get_paginated_response(self, data):
|
||
|
return Response({
|
||
|
'current_page': self.page.number,
|
||
|
'total_results': self.page.paginator.count,
|
||
|
'total_pages': self.page.paginator.num_pages,
|
||
|
'results': data
|
||
|
})
|