From c29a91c70de7d585e52c617d77e2f061cfad0cde Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Thu, 7 Sep 2017 12:23:32 +0200 Subject: La commande cleancourses efface les différences de cours --- management/commands/cleancourses.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'management/commands') diff --git a/management/commands/cleancourses.py b/management/commands/cleancourses.py index 5f71861..42f8f8b 100644 --- a/management/commands/cleancourses.py +++ b/management/commands/cleancourses.py @@ -16,7 +16,7 @@ from django.core.management.base import BaseCommand from django.db import transaction -from edt.models import Course, Group, LastUpdate +from edt.models import Course, CourseDelta, Group, LastUpdate class Command(BaseCommand): @@ -28,10 +28,12 @@ class Command(BaseCommand): def handle(self, *args, **options): with transaction.atomic(): if options["timetable"] is None: + CourseDelta.objects.all().delete() Course.objects.all().delete() Group.objects.all().delete() LastUpdate.objects.all().delete() else: + CourseDelta.objects.filter(course__timetable__id__in=options["timetable"]).delete() Course.objects.filter(timetable__id__in=options["timetable"]).delete() Group.objects.filter(timetable__id__in=options["timetable"]).delete() LastUpdate.objects.filter(timetable__id__in=options["timetable"]).delete() -- cgit v1.2.1