aboutsummaryrefslogtreecommitdiff
path: root/management/commands
diff options
context:
space:
mode:
Diffstat (limited to 'management/commands')
-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()