From e52f9abd61a85032f23d608709362e6c0a1dfce7 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sat, 1 Nov 2025 11:26:22 +0330 Subject: [PATCH] fix - search in page & permissions --- apps/authorization/api/v1/api.py | 6 +++--- logs/django_requests.log | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/authorization/api/v1/api.py b/apps/authorization/api/v1/api.py index a40b334..0dd04cb 100644 --- a/apps/authorization/api/v1/api.py +++ b/apps/authorization/api/v1/api.py @@ -63,7 +63,7 @@ class PageViewSet(SoftDeleteMixin, viewsets.ModelViewSet): def list(self, request, *args, **kwargs): """ all pages """ - page = self.paginate_queryset(self.queryset.order_by('-create_date')) + page = self.paginate_queryset(self.filter_queryset(self.queryset.order_by('-modify_date'))) if page is not None: # noqa serializer = self.get_serializer(page, many=True) return self.get_paginated_response(serializer.data) @@ -97,7 +97,7 @@ class PermissionViewSet(SoftDeleteMixin, viewsets.ModelViewSet): search_fields = ['page__name', ] def list(self, request, *args, **kwargs): - queryset = self.filter_queryset(self.get_queryset().order_by('-create_date')) # noqa + queryset = self.filter_queryset(self.get_queryset().order_by('-modify_date')) # noqa page = self.paginate_queryset(queryset) if page is not None: @@ -133,7 +133,7 @@ class PermissionViewSet(SoftDeleteMixin, viewsets.ModelViewSet): role_num=Count('role'), ).filter(user_relation_num=0, role_num=0) # noqa - page = self.paginate_queryset(permissions) + page = self.paginate_queryset(self.filter_queryset(permissions)) if page is not None: serializer = self.get_serializer(page, many=True) return self.get_paginated_response(serializer.data) diff --git a/logs/django_requests.log b/logs/django_requests.log index 51bece5..9a633ad 100644 --- a/logs/django_requests.log +++ b/logs/django_requests.log @@ -611,3 +611,10 @@ AssertionError: .validate() should return the validated data [2025-11-01 10:02:53,718] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\product\services\distribution_child.py changed, reloading. [2025-11-01 10:02:59,031] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader [2025-11-01 10:12:17,522] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\api.py changed, reloading. +[2025-11-01 10:12:20,418] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader +[2025-11-01 11:22:34,780] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authorization\api\v1\api.py changed, reloading. +[2025-11-01 11:22:37,538] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader +[2025-11-01 11:23:24,510] INFO django.server | IP: - | Path: - | "GET /auth/api/v1/page/?search=farmer_plans HTTP/1.1" 200 482 +[2025-11-01 11:23:37,709] INFO django.server | IP: - | Path: - | "GET /auth/api/v1/page/?search=pos_accouns HTTP/1.1" 200 581 +[2025-11-01 11:25:55,672] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authorization\api\v1\api.py changed, reloading. +[2025-11-01 11:25:58,353] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader