fix - search in page & permissions

This commit is contained in:
2025-11-01 11:26:22 +03:30
parent fc67266d64
commit e52f9abd61
2 changed files with 10 additions and 3 deletions

View File

@@ -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)

View File

@@ -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