Все тесты с пагинацией

This commit is contained in:
Andrei Filippov committed 2024-09-10 14:39:43 +03:00
1 parent e70607a81e
commit 45f5f12704
3 files changed
+33 -15

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.response import Response
class AllTestsPagination(LimitOffsetPagination):
# Переопределяем лимит по умолчанию
default_limit = 1
# Максимальный лимит на странице
max_limit = 3
def get_paginated_response(self, data):
return Response({
'total_count':self.count,
'limit': self.limit,
'offset': self.offset,
'results': data,
})