mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
69 lines
2.4 KiB
Python
69 lines
2.4 KiB
Python
from django.db import models
|
|
from GestionLogin.models import Profil
|
|
from django.db.models import JSONField
|
|
from django.dispatch import receiver
|
|
from django.contrib.postgres.fields import ArrayField
|
|
|
|
NIVEAU_CHOICES = [
|
|
(1, 'Très Petite Section (TPS)'),
|
|
(2, 'Petite Section (PS)'),
|
|
(3, 'Moyenne Section (MS)'),
|
|
(4, 'Grande Section (GS)'),
|
|
(5, 'Cours Préparatoire (CP)'),
|
|
(6, 'Cours Élémentaire 1 (CE1)'),
|
|
(7, 'Cours Élémentaire 2 (CE2)'),
|
|
(8, 'Cours Moyen 1 (CM1)'),
|
|
(9, 'Cours Moyen 2 (CM2)')
|
|
]
|
|
|
|
class Specialite(models.Model):
|
|
nom = models.CharField(max_length=100)
|
|
dateCreation = models.DateTimeField(auto_now=True)
|
|
codeCouleur = models.CharField(max_length=7, default='#FFFFFF')
|
|
|
|
def __str__(self):
|
|
return self.nom
|
|
|
|
class Enseignant(models.Model):
|
|
nom = models.CharField(max_length=100)
|
|
prenom = models.CharField(max_length=100)
|
|
mail = models.EmailField(unique=True)
|
|
specialites = models.ManyToManyField(Specialite, related_name='enseignants')
|
|
profilAssocie = models.ForeignKey(Profil, on_delete=models.CASCADE, null=True, blank=True)
|
|
dateCreation = models.DateTimeField(auto_now=True)
|
|
|
|
def __str__(self):
|
|
return f"{self.nom} {self.prenom}"
|
|
|
|
class Classe(models.Model):
|
|
PLANNING_TYPE_CHOICES = [
|
|
(1, 'Annuel'),
|
|
(2, 'Semestriel'),
|
|
(3, 'Trimestriel')
|
|
]
|
|
|
|
nom_ambiance = models.CharField(max_length=255, null=True, blank=True)
|
|
tranche_age = models.JSONField()
|
|
nombre_eleves = models.PositiveIntegerField()
|
|
langue_enseignement = models.CharField(max_length=255)
|
|
annee_scolaire = models.CharField(max_length=9)
|
|
dateCreation = models.DateTimeField(auto_now_add=True)
|
|
enseignants = models.ManyToManyField(Enseignant, related_name='classes')
|
|
niveaux = ArrayField(models.IntegerField(choices=NIVEAU_CHOICES), default=list)
|
|
type = models.IntegerField(choices=PLANNING_TYPE_CHOICES, default=1)
|
|
plage_horaire = models.JSONField(default=list)
|
|
jours_ouverture = ArrayField(models.IntegerField(), default=list)
|
|
|
|
def __str__(self):
|
|
return self.nom_ambiance
|
|
|
|
class Planning(models.Model):
|
|
niveau = models.IntegerField(choices=NIVEAU_CHOICES, null=True, blank=True)
|
|
classe = models.ForeignKey(Classe, null=True, blank=True, related_name='plannings', on_delete=models.CASCADE)
|
|
emploiDuTemps = JSONField(default=dict)
|
|
|
|
def __str__(self):
|
|
return f'Planning de {self.niveau} pour {self.classe.nom_ambiance}'
|
|
|
|
|