From cca24d6f6aa3881760678135b3cd83fb4cc15bb2 Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sat, 1 Nov 2025 14:34:31 +0330 Subject: [PATCH] fix - transaction & show users with my organization except me --- apps/core/api.py | 3 ++- logs/django_requests.log | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/core/api.py b/apps/core/api.py index 22e3a4e..d673e39 100644 --- a/apps/core/api.py +++ b/apps/core/api.py @@ -38,7 +38,8 @@ class BaseViewSet(RegionFilterMixin, viewsets.ModelViewSet): if model_name == 'userrelations': # noqa # add all users with my organization except my user child_orgs.append(org) - queryset = (queryset.filter(organization__in=child_orgs).exclude(user=user)) + child_roles = get_all_role_child(user_relation.role) + queryset = (queryset.filter(organization__in=child_orgs, role__in=child_roles).exclude(user=user)) elif model_name == 'organization': queryset = queryset.filter(id__in=[org.id for org in child_orgs]) diff --git a/logs/django_requests.log b/logs/django_requests.log index 012f1e2..add8fa0 100644 --- a/logs/django_requests.log +++ b/logs/django_requests.log @@ -631,3 +631,5 @@ AssertionError: .validate() should return the validated data [2025-11-01 13:57:55,398] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\warehouse\web\api\v1\api.py changed, reloading. [2025-11-01 13:58:02,091] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader [2025-11-01 14:19:59,373] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\core\api.py changed, reloading. +[2025-11-01 14:20:01,908] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader +[2025-11-01 14:34:29,660] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\core\api.py changed, reloading.