From da9ad0367ea94ccfec50cc691f34e97814fa905a Mon Sep 17 00:00:00 2001 From: Andrei Filippov Date: Thu, 26 Sep 2024 12:31:25 +0300 Subject: [PATCH] =?UTF-8?q?p-80=20=D0=B2=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/back/tests/pagination.py | 10 +--------- src/back/tests/views.py | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/back/tests/pagination.py b/src/back/tests/pagination.py index 342d6284d..d498301fc 100644 --- a/src/back/tests/pagination.py +++ b/src/back/tests/pagination.py @@ -2,12 +2,8 @@ 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): + def get_paginated_response(self, data): return Response({ 'total_count':self.count, 'limit': self.limit, @@ -18,8 +14,6 @@ class AllTestsPagination(LimitOffsetPagination): class AppointmentUserPagination(LimitOffsetPagination): - default_limit = 1 - max_limit = 3 def get_paginated_response(self, data): return Response({ 'total_count': self.count, @@ -29,8 +23,6 @@ class AppointmentUserPagination(LimitOffsetPagination): }) class AccomplishedPagination(LimitOffsetPagination): - default_limit = 1 - max_limit = 3 def get_paginated_response(self, data): return Response({ 'total_count': self.count, diff --git a/src/back/tests/views.py b/src/back/tests/views.py index 03aa2cdb2..8091bd2b7 100644 --- a/src/back/tests/views.py +++ b/src/back/tests/views.py @@ -18,7 +18,7 @@ class GetAllTests(APIView): return paginator.get_paginated_response(serializer.data) - +# Количество страниц передавать с фронта class GetAppointmentsUsers(APIView): def get(self, request): id_user = request.GET.get('id') @@ -28,7 +28,7 @@ class GetAppointmentsUsers(APIView): serializer = SavedResultTestSerializer(paginated_queryset, many=True) return paginator.get_paginated_response(serializer.data) - +# Количество страниц передавать с фронта class GetAccompishedTests(APIView): def get(self, request): id_user = request.GET.get('id')