chore: Suppression de champs requis lors de la création d'une classe

(non obligatoire pour la tranche d'age par exemple)
This commit is contained in:
N3WT DE COMPET
2025-05-22 19:08:40 +02:00
parent 87b8cf6c05
commit 3e5cebef44
2 changed files with 4 additions and 8 deletions

View File

@ -44,8 +44,8 @@ class SchoolClass(models.Model):
]
atmosphere_name = models.CharField(max_length=255, null=True, blank=True)
age_range = models.JSONField(blank=True)
number_of_students = models.PositiveIntegerField(blank=True)
age_range = models.JSONField(null=True, blank=True)
number_of_students = models.PositiveIntegerField(null=True, blank=True)
teaching_language = models.CharField(max_length=255, blank=True)
school_year = models.CharField(max_length=9, blank=True)
updated_date = models.DateTimeField(auto_now=True)

View File

@ -168,7 +168,7 @@ const ClassesSection = ({
atmosphere_name: '',
age_range: '',
levels: [],
number_of_students: '',
number_of_students: null,
school_year: '',
teachers: [],
establishment: selectedEstablishmentId,
@ -177,7 +177,7 @@ const ClassesSection = ({
atmosphere_name: '',
age_range: '',
levels: [],
number_of_students: '',
number_of_students: null,
school_year: '',
teachers: [],
establishment: selectedEstablishmentId,
@ -203,9 +203,7 @@ const ClassesSection = ({
const handleSaveNewClass = () => {
if (
newClass.atmosphere_name &&
newClass.age_range &&
newClass.levels.length > 0 &&
newClass.number_of_students &&
newClass.school_year
) {
handleCreate(newClass)
@ -242,9 +240,7 @@ const ClassesSection = ({
const handleUpdateClass = (id, updatedData) => {
if (
updatedData.atmosphere_name &&
updatedData.age_range &&
updatedData.levels.length > 0 &&
updatedData.number_of_students &&
updatedData.school_year
) {
handleEdit(id, updatedData)