From e1867b989a913612cf2c4c76e8cecd60f479b4c2 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Thu, 7 Sep 2017 12:24:11 +0200 Subject: Suppression des fonctions et imports inutiles --- management/commands/_private.py | 9 +-------- management/commands/timetables.py | 5 ++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/management/commands/_private.py b/management/commands/_private.py index 72e5440..f0b5b87 100644 --- a/management/commands/_private.py +++ b/management/commands/_private.py @@ -16,9 +16,7 @@ from bs4 import BeautifulSoup from django.utils import timezone - -from edt.models import Group, Room, Course -from edt.utils import get_week +from edt.models import Group, Room import datetime import requests @@ -62,11 +60,6 @@ def consolidate_groups(groups): if group.parent == None: consolidate_group(group) -def delete_courses_in_week(timetable, year, week): - start, end = get_week(year, week) - Course.objects.filter(begin__gte=start, begin__lt=end, - timetable=timetable).delete() - def get_from_db_or_create(cls, **kwargs): obj = cls.objects.all().filter(**kwargs) diff --git a/management/commands/timetables.py b/management/commands/timetables.py index 389473f..0f9ee1b 100644 --- a/management/commands/timetables.py +++ b/management/commands/timetables.py @@ -21,14 +21,13 @@ from django.utils import timezone from edt.models import Timetable, LastUpdate, Course, CourseDelta from edt.utils import get_week -from ._private import delete_courses_in_week, get_events, get_weeks, get_xml + +from ._private import get_events, get_weeks, get_xml import datetime @transaction.atomic def process_timetable_week(timetable, year, week, soup, weeks_in_soup): - # delete_courses_in_week(timetable, year, week) - date = timezone.make_aware(datetime.datetime.now()) last_update = LastUpdate(timetable=timetable, year=year, week=week, date=date) last_update.save() -- cgit v1.2.1