diff --git a/apps/authorization/api/v1/serializers.py b/apps/authorization/api/v1/serializers.py index 97cd1b3..bb3e4b1 100644 --- a/apps/authorization/api/v1/serializers.py +++ b/apps/authorization/api/v1/serializers.py @@ -105,6 +105,8 @@ class RoleSerializer(serializers.ModelSerializer): """ representation = super().to_representation(instance) representation['type'] = auth_serializer.OrganizationTypeSerializer(instance.type).data + if instance.parent_role: + representation['parent_role'] = {'name': instance.parent_role.role_name, 'id': instance.parent_role.id} if instance.permissions: # noqa permissions = instance.permissions.filter(is_active=True) representation['permissions'] = PermissionSerializer(permissions, many=True).data diff --git a/logs/django_requests.log b/logs/django_requests.log index 9b193e6..00ddd4a 100644 --- a/logs/django_requests.log +++ b/logs/django_requests.log @@ -278,3 +278,5 @@ django.core.exceptions.FieldError: Unsupported lookup 'name' for ForeignKey or j [2025-10-28 09:03:36,050] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader [2025-10-28 09:07:59,433] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authorization\api\v1\serializers.py changed, reloading. [2025-10-28 09:08:01,206] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader +[2025-10-28 09:15:25,146] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authorization\api\v1\serializers.py changed, reloading. +[2025-10-28 09:15:27,109] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader