to_inventory/back/tgbot/pagination.py

12 lines
388 B
Python

from rest_framework import pagination
from rest_framework.response import Response
class CustomPagination(pagination.PageNumberPagination):
page_size_query_param = 'size'
def get_paginated_response(self, data):
return Response({
'count': self.page.paginator.count,
'per_page': self.page.paginator.per_page,
'results': data
})