From f0c61f1a3a26f8c76f43b21f7860d83041b7fe89 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sun, 1 Oct 2017 16:44:53 +0200 Subject: Ajout d’une colonne pour stocker la date de dernière mise à jour --- management/commands/timetables.py | 3 +++ models.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/management/commands/timetables.py b/management/commands/timetables.py index e82fd55..76f0a7c 100644 --- a/management/commands/timetables.py +++ b/management/commands/timetables.py @@ -50,6 +50,9 @@ def process_timetable_week(timetable, soup, weeks_in_soup, force, year=None, wee for course in get_events(timetable, soup, weeks_in_soup, year, week): course.save() + timetable.last_update_date = new_update_date + timetable.save() + def process_timetable(timetable, force, year=None, weeks=None): soup = get_xml(timetable.url) weeks_in_soup = get_weeks(soup) diff --git a/models.py b/models.py index ae9265a..649368e 100644 --- a/models.py +++ b/models.py @@ -54,6 +54,8 @@ class Timetable(SlugModel): 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) + def __str__(self): return self.year.name + " " + self.name -- cgit v1.2.1