mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Ajout des payementPlans dans le formulaire / ajout de la photo
This commit is contained in:
@ -3,7 +3,7 @@ from django.utils.timezone import now
|
||||
from django.conf import settings
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from School.models import SchoolClass, Fee, Discount, PaymentModeType
|
||||
from School.models import SchoolClass, Fee, Discount, PaymentModeType, PaymentPlanType
|
||||
from Auth.models import ProfileRole
|
||||
from Establishment.models import Establishment
|
||||
|
||||
@ -229,6 +229,8 @@ class RegistrationForm(models.Model):
|
||||
establishment = models.ForeignKey(Establishment, on_delete=models.CASCADE, related_name='register_forms')
|
||||
registration_payment = models.IntegerField(choices=PaymentModeType.choices, null=True, blank=True)
|
||||
tuition_payment = models.IntegerField(choices=PaymentModeType.choices, null=True, blank=True)
|
||||
registration_payment_plan = models.IntegerField(choices=PaymentPlanType.choices, null=True, blank=True)
|
||||
tuition_payment_plan = models.IntegerField(choices=PaymentPlanType.choices, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return "RF_" + self.student.last_name + "_" + self.student.first_name
|
||||
|
||||
@ -231,6 +231,7 @@ class RegisterFormWithIdView(APIView):
|
||||
"""
|
||||
|
||||
studentForm_data = request.data.get('data', '{}')
|
||||
print(f'studentForm_data : {studentForm_data}')
|
||||
try:
|
||||
data = json.loads(studentForm_data)
|
||||
except json.JSONDecodeError:
|
||||
@ -239,10 +240,16 @@ class RegisterFormWithIdView(APIView):
|
||||
# Extraire le fichier photo
|
||||
photo_file = request.FILES.get('photo')
|
||||
|
||||
# Extraire le fichier photo
|
||||
sepa_file = request.FILES.get('sepa_file')
|
||||
|
||||
# Ajouter la photo aux données de l'étudiant
|
||||
if photo_file:
|
||||
data['student']['photo'] = photo_file
|
||||
|
||||
if sepa_file:
|
||||
data['sepa_file'] = sepa_file
|
||||
|
||||
# Gérer le champ `_status`
|
||||
_status = data.pop('status', 0)
|
||||
_status = int(_status)
|
||||
@ -307,7 +314,7 @@ class RegisterFormWithIdView(APIView):
|
||||
|
||||
elif _status == RegistrationForm.RegistrationFormStatus.RF_VALIDATED:
|
||||
# Vérifier si le paramètre fusion est activé via l'URL
|
||||
fusion = studentForm_data.get('fusion', False)
|
||||
fusion = data.get('fusion', False)
|
||||
if fusion:
|
||||
# Fusion des documents
|
||||
# Récupération des fichiers schoolFileTemplates
|
||||
|
||||
Reference in New Issue
Block a user