mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Gestion de la sauvegarde du fichier d'inscription / affichage du
fichier avec le bon nom / possibilité de refuser un DI
This commit is contained in:
@ -4,10 +4,12 @@ from rest_framework.views import APIView
|
||||
from drf_yasg.utils import swagger_auto_schema
|
||||
from drf_yasg import openapi
|
||||
|
||||
from Subscriptions.models import Guardian, Student
|
||||
from Subscriptions.models import Guardian, Student, RegistrationForm
|
||||
from Auth.models import ProfileRole
|
||||
from N3wtSchool import bdd
|
||||
|
||||
import Subscriptions.util as util
|
||||
|
||||
class GuardianView(APIView):
|
||||
"""
|
||||
Gestion des responsables légaux.
|
||||
@ -74,6 +76,16 @@ class DissociateGuardianView(APIView):
|
||||
# Supprimer le guardian
|
||||
guardian.delete()
|
||||
|
||||
# Récupérer le RegistrationForm associé au Student
|
||||
registerForm = bdd.getObject(RegistrationForm, "student__id", student_id)
|
||||
if registerForm:
|
||||
# Réinitialiser le statut en "Créé"
|
||||
registerForm.status = RegistrationForm.RegistrationFormStatus.RF_CREATED
|
||||
registerForm.save()
|
||||
|
||||
# Supprimer le fichier et le dossier associés
|
||||
util.delete_registration_files(registerForm)
|
||||
|
||||
return JsonResponse(
|
||||
{
|
||||
"message": f"Le guardian {guardian.last_name} {guardian.first_name} a été dissocié de l'étudiant {student.last_name} {student.first_name}.",
|
||||
|
||||
Reference in New Issue
Block a user