feat: Création d'un annuaire / mise à jour du subscribe

This commit is contained in:
N3WT DE COMPET
2025-03-14 19:51:35 +01:00
parent cd9c10a88a
commit 6bd5704983
22 changed files with 585 additions and 185 deletions

View File

@ -49,7 +49,9 @@ class TeacherSerializer(serializers.ModelSerializer):
if profile_role_data:
establishment_id = profile_role_data.pop('establishment').id
profile_id = profile_role_data.pop('profile').id
profile_role_data['establishment'] = establishment_id
profile_role_data['profile'] = profile_id
# Créer l'instance de ProfileRole
profile_role_serializer = ProfileRoleSerializer(data=profile_role_data)
@ -95,7 +97,9 @@ class TeacherSerializer(serializers.ModelSerializer):
def get_role_type(self, obj):
profile_role = obj.profile_role
return {'role_type': profile_role.role_type, 'establishment': profile_role.establishment.name}
if profile_role:
return {'role_type': profile_role.role_type, 'establishment': profile_role.establishment.name}
return None
def get_specialities_details(self, obj):
return [{'id': speciality.id, 'name': speciality.name, 'color_code': speciality.color_code} for speciality in obj.specialities.all()]