mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Formulaire de création RF sur une seule pag
This commit is contained in:
@ -44,6 +44,8 @@ from Auth.serializers import ProfileSerializer, ProfileRoleSerializer
|
||||
from Establishment.serializers import EstablishmentSerializer
|
||||
from Subscriptions.serializers import RegistrationFormSerializer, StudentSerializer
|
||||
|
||||
from Subscriptions.util import getCurrentSchoolYear, getNextSchoolYear # Import des fonctions nécessaires
|
||||
|
||||
# Définir le chemin vers le dossier mock_datas
|
||||
MOCK_DATAS_PATH = os.path.join(settings.BASE_DIR, 'School', 'management', 'mock_datas')
|
||||
|
||||
@ -371,7 +373,7 @@ class Command(BaseCommand):
|
||||
"first_name": fake.first_name(),
|
||||
"birth_date": fake.date_of_birth().strftime('%Y-%m-%d'),
|
||||
"address": fake.address(),
|
||||
"phone":"+33122334455",
|
||||
"phone": "+33122334455",
|
||||
"profession": fake.job()
|
||||
}
|
||||
|
||||
@ -403,11 +405,15 @@ class Command(BaseCommand):
|
||||
fees = Fee.objects.filter(id__in=[1, 2, 3, 4])
|
||||
discounts = Discount.objects.filter(id__in=[1])
|
||||
|
||||
# Déterminer l'année scolaire (soit l'année en cours, soit l'année prochaine)
|
||||
school_year = random.choice([getCurrentSchoolYear(), getNextSchoolYear()])
|
||||
|
||||
# Créer les données du formulaire d'inscription
|
||||
register_form_data = {
|
||||
"fileGroup": RegistrationFileGroup.objects.get(id=fake.random_int(min=1, max=file_group_count)),
|
||||
"establishment": profile_role.establishment,
|
||||
"status": fake.random_int(min=1, max=3)
|
||||
"status": fake.random_int(min=1, max=3),
|
||||
"school_year": school_year # Ajouter l'année scolaire
|
||||
}
|
||||
|
||||
# Créer ou mettre à jour le formulaire d'inscription
|
||||
@ -420,7 +426,7 @@ class Command(BaseCommand):
|
||||
if created:
|
||||
register_form.fees.set(fees)
|
||||
register_form.discounts.set(discounts)
|
||||
self.stdout.write(self.style.SUCCESS(f'RegistrationForm for student {student.last_name} created successfully'))
|
||||
self.stdout.write(self.style.SUCCESS(f'RegistrationForm for student {student.last_name} created successfully with school year {school_year}'))
|
||||
else:
|
||||
self.stdout.write(self.style.SUCCESS(f'RegistrationForm for student {student.last_name} already exists'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user