feat: Gestion des absences du jour [#16]

This commit is contained in:
N3WT DE COMPET
2025-05-04 12:08:05 +02:00
parent 1bccc85951
commit 030d19d411
13 changed files with 516 additions and 311 deletions

View File

@ -130,34 +130,4 @@ class PaymentMode(models.Model):
establishment = models.ForeignKey(Establishment, on_delete=models.CASCADE, related_name='payment_modes')
def __str__(self):
return f"{self.get_mode_display()} - {self.get_type_display()}"
class AbsenceMoment(models.IntegerChoices):
MORNING = 1, 'Morning'
AFTERNOON = 2, 'Afternoon'
TOTAL = 3, 'Total'
class AbsenceReason(models.IntegerChoices):
JUSTIFIED_ABSENCE = 1, 'Justified Absence'
UNJUSTIFIED_ABSENCE = 2, 'Unjustified Absence'
JUSTIFIED_LATE = 3, 'Justified Late'
UNJUSTIFIED_LATE = 4, 'Unjustified Late'
class AbsenceManagement(models.Model):
day = models.DateField()
moment = models.IntegerField(
choices=AbsenceMoment.choices,
default=AbsenceMoment.TOTAL
)
reason = models.IntegerField(
choices=AbsenceReason.choices,
default=AbsenceReason.UNJUSTIFIED_ABSENCE
)
student = models.ForeignKey(
'Subscriptions.Student',
on_delete=models.CASCADE,
related_name='absences'
)
def __str__(self):
return f"{self.student} - {self.day} - {self.get_moment_display()} - {self.get_reason_display()}"
return f"{self.get_mode_display()} - {self.get_type_display()}"