p-80 выполнена

This commit is contained in:
Andrei Filippov committed 2024-09-26 12:31:25 +03:00
1 parent e1cf6e5ca7
commit da9ad0367e
2 files changed
+3 -11

No files matched your search

+1 -9
View File
@@ -2,12 +2,8 @@ from rest_framework.pagination import LimitOffsetPagination
from rest_framework.response import Response from rest_framework.response import Response
class AllTestsPagination(LimitOffsetPagination): class AllTestsPagination(LimitOffsetPagination):
# Переопределяем лимит по умолчанию
default_limit = 1
# Максимальный лимит на странице
max_limit = 3
def get_paginated_response(self, data):
def get_paginated_response(self, data):
return Response({ return Response({
'total_count':self.count, 'total_count':self.count,
'limit': self.limit, 'limit': self.limit,
@@ -18,8 +14,6 @@ class AllTestsPagination(LimitOffsetPagination):
class AppointmentUserPagination(LimitOffsetPagination): class AppointmentUserPagination(LimitOffsetPagination):
default_limit = 1
max_limit = 3
def get_paginated_response(self, data): def get_paginated_response(self, data):
return Response({ return Response({
'total_count': self.count, 'total_count': self.count,
@@ -29,8 +23,6 @@ class AppointmentUserPagination(LimitOffsetPagination):
}) })
class AccomplishedPagination(LimitOffsetPagination): class AccomplishedPagination(LimitOffsetPagination):
default_limit = 1
max_limit = 3
def get_paginated_response(self, data): def get_paginated_response(self, data):
return Response({ return Response({
'total_count': self.count, 'total_count': self.count,
+2 -2
View File
@@ -18,7 +18,7 @@ class GetAllTests(APIView):
return paginator.get_paginated_response(serializer.data) return paginator.get_paginated_response(serializer.data)
# Количество страниц передавать с фронта
class GetAppointmentsUsers(APIView): class GetAppointmentsUsers(APIView):
def get(self, request): def get(self, request):
id_user = request.GET.get('id') id_user = request.GET.get('id')
@@ -28,7 +28,7 @@ class GetAppointmentsUsers(APIView):
serializer = SavedResultTestSerializer(paginated_queryset, many=True) serializer = SavedResultTestSerializer(paginated_queryset, many=True)
return paginator.get_paginated_response(serializer.data) return paginator.get_paginated_response(serializer.data)
# Количество страниц передавать с фронта
class GetAccompishedTests(APIView): class GetAccompishedTests(APIView):
def get(self, request): def get(self, request):
id_user = request.GET.get('id') id_user = request.GET.get('id')