mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Création d'un annuaire / mise à jour du subscribe
This commit is contained in:
@ -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()]
|
||||
|
||||
Reference in New Issue
Block a user