17 lines
No EOL
492 B
Python
17 lines
No EOL
492 B
Python
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
|
|
}) |