diff --git a/Back-End/School/management/commands/init_mock_datas.py b/Back-End/School/management/commands/init_mock_datas.py index 2f74379..4ae7ed3 100644 --- a/Back-End/School/management/commands/init_mock_datas.py +++ b/Back-End/School/management/commands/init_mock_datas.py @@ -6,8 +6,7 @@ from Subscriptions.models import ( Guardian, Fee, Discount, - RegistrationFileGroup, - # RegistrationFileTemplate + RegistrationFileGroup ) from Auth.models import Profile from School.models import ( @@ -29,6 +28,7 @@ from django.core.files import File from django.core.exceptions import SuspiciousFileOperation import os from django.conf import settings +from faker import Faker class Command(BaseCommand): help = 'Initialise toutes les données mock' @@ -448,26 +448,21 @@ class Command(BaseCommand): self.stdout.write(self.style.SUCCESS('RegistrationFileTemplates initialized or updated successfully')) + from faker import Faker + def create_register_form(self): - # Créer ou mettre à jour le profil associé au guardian - profiles_data = [ - { - "email": "anthony.casini.30@gmail.com", + fake = Faker('fr_FR') # Utiliser le locale français pour Faker + + for _ in range(50): + # Générer des données fictives pour le profil + profile_data = { + "email": fake.email(), "droit": 2, - "username": "anthony.casini.30@gmail.com", - "is_active": True, - "password": "Provisoire01!" - }, - { - "email": "anthony.audrey.34@gmail.com", - "droit": 2, - "username": "anthony.audrey.34@gmail.com", + "username": fake.user_name(), "is_active": True, "password": "Provisoire01!" } - ] - for profile_data in profiles_data: user, created = Profile.objects.update_or_create( email=profile_data["email"], defaults={ @@ -481,16 +476,23 @@ class Command(BaseCommand): user.set_password(profile_data["password"]) user.save() - # Créer les données du guardian + # Générer des données fictives pour le guardian guardian_data = { "associated_profile_id": user.id, "email": profile_data["email"], } - # Créer les données de l'étudiant + # Générer des données fictives pour l'étudiant student_data = { - "last_name": f'lastname_{user.id}', - "first_name": f'firstname_{user.id}', + "last_name": fake.last_name(), + "first_name": fake.first_name(), + "address": fake.address(), + "birth_date": fake.date_of_birth(), + "birth_place": fake.city(), + "birth_postal_code": fake.postcode(), + "nationality": fake.country(), + "attending_physician": fake.name(), + "level": fake.random_int(min=1, max=6) } # Créer ou mettre à jour l'étudiant et le guardian @@ -514,7 +516,7 @@ class Command(BaseCommand): "student": student, "fileGroup": self.registration_file_group_1, "establishment": Establishment.objects.get(id=1), - "status": 1 + "status": fake.random_int(min=1, max=3) } # Créer ou mettre à jour le formulaire d'inscription @@ -525,4 +527,4 @@ class Command(BaseCommand): register_form.fileGroup = self.registration_file_group_1 register_form.save() - self.stdout.write(self.style.SUCCESS('RegistrationForm initialized or updated successfully')) \ No newline at end of file + self.stdout.write(self.style.SUCCESS('50 RegistrationForms initialized or updated successfully')) \ No newline at end of file diff --git a/Back-End/requirements.txt b/Back-End/requirements.txt index 11ec216..85047c7 100644 Binary files a/Back-End/requirements.txt and b/Back-End/requirements.txt differ diff --git a/Front-End/src/components/Structure/Files/FilesGroupsManagement.js b/Front-End/src/components/Structure/Files/FilesGroupsManagement.js index af8851a..1763176 100644 --- a/Front-End/src/components/Structure/Files/FilesGroupsManagement.js +++ b/Front-End/src/components/Structure/Files/FilesGroupsManagement.js @@ -50,7 +50,6 @@ export default function FilesGroupsManagement({ csrfToken }) { ]).then(([filesTemplateMasters, groupsData, filesTemplates]) => { setGroups(groupsData); setTemplates(filesTemplates); - console.log("coucou : ", filesTemplates) // Sélectionner automatiquement le premier groupe s'il existe if (groupsData.length > 0) { setSelectedGroup(groupsData[0].id.toString());