Все тесты с пагинацией
This commit is contained in:
1 parent
e70607a81e
commit
45f5f12704
3 files changed
+33
-15
No files matched your search
@@ -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,
|
||||
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user