diff options
author | Alban Gruin | 2017-09-24 17:36:40 +0200 |
---|---|---|
committer | Alban Gruin | 2017-09-24 17:36:40 +0200 |
commit | dc5618c3b3af18a5f6e1d50844097c745317125a (patch) | |
tree | 5f42ea7200fb7bc2d0aada47e4df90ae4e9da87f /management/commands/timetables.py | |
parent | e30b0c673cae607175c5bae6df6e87d8b100bdf3 (diff) |
Ajout de la date et de l’heure automatiquement lors de la création
d’un cours
Diffstat (limited to 'management/commands/timetables.py')
-rw-r--r-- | management/commands/timetables.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/management/commands/timetables.py b/management/commands/timetables.py index 45a57ee..0716a91 100644 --- a/management/commands/timetables.py +++ b/management/commands/timetables.py @@ -15,6 +15,7 @@ from django.core.management.base import BaseCommand from django.db import transaction +from django.db.models import Max from django.utils import timezone from edt.models import Timetable, Course @@ -27,9 +28,8 @@ import datetime def process_timetable_week(timetable, year, week, soup, weeks_in_soup): begin, end = get_weeks(year, week) - last_update_date = Course.objects.filter(begin__gte=start, begin__lt=end).aggregate(Max("last_update"))["last_update__max"] + last_update_date = Course.objects.filter(begin__gte=begin, begin__lt=end).aggregate(Max("last_update"))["last_update__max"] new_update_date = get_update_date(soup) - updated_at = timezone.make_aware(datetime.datetime.now()) if last_update_date is not None and new_update_date is not None and \ last_update_date >= new_update_date: @@ -42,7 +42,6 @@ def process_timetable_week(timetable, year, week, soup, weeks_in_soup): course.name = name course.type = type_ course.notes = notes - course.updated_at = updated_at course.groups.add(*groups) if rooms is not None: |