14 lines
395 B
Python
14 lines
395 B
Python
# -*- coding: UTF-8 -*-
|
|
from rest_framework import pagination
|
|
from rest_framework.response import Response
|
|
|
|
class PagePaginationWithPageCount(pagination.PageNumberPagination):
|
|
page_size_query_param = 'page_size'
|
|
|
|
def get_paginated_response(self, data):
|
|
response = super().get_paginated_response(data)
|
|
response.data['page_count'] = self.page.paginator.num_pages
|
|
return response
|
|
|
|
|