fix - transaction & show users with my organization except me

This commit is contained in:
2025-11-01 14:34:31 +03:30
parent f8320b6e44
commit cca24d6f6a
2 changed files with 4 additions and 1 deletions

View File

@@ -38,7 +38,8 @@ class BaseViewSet(RegionFilterMixin, viewsets.ModelViewSet):
if model_name == 'userrelations': # noqa if model_name == 'userrelations': # noqa
# add all users with my organization except my user # add all users with my organization except my user
child_orgs.append(org) 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': elif model_name == 'organization':
queryset = queryset.filter(id__in=[org.id for org in child_orgs]) queryset = queryset.filter(id__in=[org.id for org in child_orgs])

View File

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