dsite/core/pagination.py
Ching a4a61b556f feat(recipe list page ): [A] 增加分页
[A] 增加分页

Signed-off-by: Ching <loooching@gmail.com>
2021-10-05 22:09:38 +08:00

10 lines
354 B
Python

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