aboutsummaryrefslogtreecommitdiff
path: root/management/commands/cleancourses.py
diff options
context:
space:
mode:
authorAlban Gruin2018-04-25 21:26:03 +0200
committerAlban Gruin2018-04-25 21:26:03 +0200
commit54c5dbb98293acea9b470808e5a35e99c004f265 (patch)
tree7fb350d07e2f2a4d687b00fd034e638bd02f8526 /management/commands/cleancourses.py
parent772caa72ce7f80bfeb5fbb1d05b57838dafd48c3 (diff)
parent5488a93bf2e04d2f19e287186011dcbb436a238b (diff)
Merge branch 'stable/0.13.z' into prod/pa1ch/0.y.z
Diffstat (limited to 'management/commands/cleancourses.py')
-rw-r--r--management/commands/cleancourses.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/management/commands/cleancourses.py b/management/commands/cleancourses.py
index f6041ef..246cfcc 100644
--- a/management/commands/cleancourses.py
+++ b/management/commands/cleancourses.py
@@ -15,22 +15,24 @@
from django.core.management.base import BaseCommand
from django.db import transaction
-from edt.models import Course, Group
+
+from ...models import Course, Group
class Command(BaseCommand):
help = "Remove all courses and groups from the database"
def add_arguments(self, parser):
- parser.add_argument("--timetable", type=int, nargs="+")
+ parser.add_argument("--source", type=int, nargs="+")
def handle(self, *args, **options):
with transaction.atomic():
- if options["timetable"] is None:
+ if options["source"] is None:
Course.objects.all().delete()
Group.objects.all().delete()
else:
- Course.objects.filter(timetable__id__in=options["timetable"]).delete()
- Group.objects.filter(timetable__id__in=options["timetable"]).delete()
+ Course.objects.filter(source__id__in=options["source"]) \
+ .delete()
+ Group.objects.filter(source__id__in=options["source"]).delete()
self.stdout.write(self.style.SUCCESS("Done."))