fixed pagination

This commit is contained in:
afanasyev.aa 2025-07-07 23:15:29 +09:00
parent 80ffab27e9
commit dd99c395a0
4 changed files with 51 additions and 15 deletions

17
api/custom_pagination.py Normal file
View file

@ -0,0 +1,17 @@
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.response import Response
class CustomLimitOffsetPagination(LimitOffsetPagination):
limit_query_param = 'limit'
offset_query_param = 'skip'
max_limit = 100
default_limit = 10
def get_paginated_response(self, data):
return Response({
'total': self.count,
'limit': self.limit,
'skip': self.offset,
'predictions': data
})