aboutsummaryrefslogtreecommitdiff
path: root/management
diff options
context:
space:
mode:
authorAlban Gruin2017-09-07 12:23:32 +0200
committerAlban Gruin2017-09-07 12:23:32 +0200
commitc29a91c70de7d585e52c617d77e2f061cfad0cde (patch)
treec33286ae07e970227e384ede8e0b0112788390fd /management
parent7e0f6810963bf272a1ff7e97061577ddc92fa19d (diff)
La commande cleancourses efface les différences de cours
Diffstat (limited to 'management')
-rw-r--r--management/commands/cleancourses.py4
1 files changed, 3 insertions, 1 deletions
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()