mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Création nouveau style / pagination profils annuaires
This commit is contained in:
@ -137,9 +137,19 @@ class StudentSerializer(serializers.ModelSerializer):
|
||||
def create_or_update_guardians(self, guardians_data):
|
||||
guardians_ids = []
|
||||
for guardian_data in guardians_data:
|
||||
guardian_id = guardian_data.get('id', None)
|
||||
profile_role_data = guardian_data.pop('profile_role_data', None)
|
||||
profile_role = guardian_data.pop('profile_role', None)
|
||||
|
||||
if guardian_id:
|
||||
# Si un ID est fourni, récupérer ou mettre à jour le Guardian existant
|
||||
guardian_instance, created = Guardian.objects.update_or_create(
|
||||
id=guardian_id,
|
||||
defaults=guardian_data
|
||||
)
|
||||
guardians_ids.append(guardian_instance.id)
|
||||
continue
|
||||
|
||||
if profile_role_data:
|
||||
# Vérifiez si 'profile_data' est fourni pour créer un nouveau profil
|
||||
profile_data = profile_role_data.pop('profile_data', None)
|
||||
@ -410,4 +420,4 @@ class NotificationSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Notification
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user