diff options
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -49,15 +49,27 @@ class Year(SlugModel): verbose_name_plural = "années" -class Timetable(SlugModel): +class Timetable(models.Model): + url = models.URLField(max_length=255, verbose_name="URL", unique=True) + last_update_date = models.DateTimeField(verbose_name="dernière mise à jour Celcat", + null=True, blank=True) + + def __str__(self): + return self.url + + + class Meta: + verbose_name = "source d’emploi du temps" + verbose_name_plural = "sources d’emploi du temps" + + +class TimetableFront(SlugModel): year = models.ForeignKey(Year, on_delete=models.CASCADE, verbose_name="année") name = models.CharField(max_length=64, verbose_name="nom") - url = models.URLField(max_length=255, verbose_name="URL") slug = models.SlugField(max_length=64, default="") - - last_update_date = models.DateTimeField(verbose_name="dernière mise à jour Celcat", - null=True, blank=True) + source = models.ForeignKey(Timetable, on_delete=models.CASCADE, + verbose_name="source") def __str__(self): return self.year.name + " " + self.name |