From caf11802f78e2a13c1a531909f459c57a93c1cc5 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Mon, 27 Oct 2025 15:41:37 +0330 Subject: [PATCH] dont show admin (BaseViewSet) --- apps/core/api.py | 2 +- logs/django_requests.log | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/core/api.py b/apps/core/api.py index 3479589..8808827 100644 --- a/apps/core/api.py +++ b/apps/core/api.py @@ -27,7 +27,7 @@ class BaseViewSet(RegionFilterMixin, viewsets.ModelViewSet): model_name = queryset.model.__name__.lower() if model_name == 'userrelations': # noqa - queryset = queryset.exclude(id=user_relation.first().id) + queryset = (queryset.exclude(id=user_relation.first().id)).exclude(role__type__key='ADM') elif model_name == 'organization': queryset = queryset.exclude(id=user_relation.first().organization.id) diff --git a/logs/django_requests.log b/logs/django_requests.log index 5de3ba7..dc71c9b 100644 --- a/logs/django_requests.log +++ b/logs/django_requests.log @@ -22,3 +22,4 @@ [2025-10-27 14:42:18,042] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader [2025-10-27 14:46:25,256] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\api\v1\serializers\serializer.py changed, reloading. [2025-10-27 14:46:27,085] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader +[2025-10-27 15:36:00,646] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\core\api.py changed, reloading.