paginate organization type

This commit is contained in:
2025-10-28 14:55:58 +03:30
parent ee7f645ecd
commit b0b6e5734d
2 changed files with 6 additions and 2 deletions

View File

@@ -213,8 +213,11 @@ class OrganizationTypeViewSet(SoftDeleteMixin, ModelViewSet):
def list(self, request, *args, **kwargs):
""" all organization type """
queryset = self.get_queryset().order_by('-modify_date')
serializer = self.serializer_class(queryset, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)
page = self.paginate_queryset(queryset.order_by('-create_date')) # paginate queryset
if page is not None: # noqa
serializer = self.serializer_class(page, many=True)
return self.get_paginated_response(serializer.data)
class OrganizationViewSet(BaseViewSet, SoftDeleteMixin, ModelViewSet, DynamicSearchMixin):

View File

@@ -322,3 +322,4 @@ django.core.exceptions.FieldError: Unsupported lookup 'name' for ForeignKey or j
[2025-10-28 14:28:55,553] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-28 14:35:00,268] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\core\api.py changed, reloading.
[2025-10-28 14:35:02,391] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-10-28 14:55:17,922] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\api.py changed, reloading.