From fe99bdc1bbaa615fbef0c4ced8e3f25a0a110b11 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Wed, 6 Sep 2017 12:48:09 +0200 Subject: Ajout du modèle « CourseDelta » pour marquer les différences entre deux mises à jour. --- models.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/models.py b/models.py index de14b43..d78e12b 100644 --- a/models.py +++ b/models.py @@ -176,3 +176,22 @@ class Course(models.Model): class Meta: verbose_name = "cours" verbose_name_plural = "cours" + + +class CourseDelta(models.Model): + ADDED = 0 + DELETED = 1 + OPERATION_CHOICE = ( + (ADDED, "Ajouté"), + (DELETED, "Supprimé"), + ) + + course = models.ForeignKey(Course, verbose_name="cours") + update = models.ForeignKey(LastUpdate, verbose_name="mise à jour") + operation = models.IntegerField(choices=OPERATION_CHOICE, default=ADDED, verbose_name="type de modification") + + + class Meta: + unique_together = ("course", "update",) + verbose_name = "modification de cours" + verbose_name_plural = "modifications de cours" -- cgit v1.2.1