dsite/core/pagination.py
Ching f683341f66 style(*.py): use Black as python code formatter
use Black as python code formatter

Signed-off-by: Ching <loooching@gmail.com>
2022-01-22 18:02:32 +08:00

13 lines
410 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