From: Guillaume Pellerin Date: Wed, 6 Feb 2013 10:24:45 +0000 (+0100) Subject: no auto department creation X-Git-Tag: 1.1~632^2~1 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=3bd187ba76bca5770928e4c042f34556732b1175;p=teleforma.git no auto department creation --- diff --git a/teleforma/management/commands/teleforma-broadcast-message.py b/teleforma/management/commands/teleforma-broadcast-message.py index c2628ab3..01fcf726 100644 --- a/teleforma/management/commands/teleforma-broadcast-message.py +++ b/teleforma/management/commands/teleforma-broadcast-message.py @@ -10,8 +10,8 @@ class Command(BaseCommand): args = "text username" def handle(self, *args, **options): - text = args[0] - username = args[1] + text = args[1] + username = args[0] user = User.objects.get(username=username) room = Room.objects.get(name='site') message = Message.objects.create_message(user, room, text) diff --git a/teleforma/management/commands/teleforma-import-conferences.py b/teleforma/management/commands/teleforma-import-conferences.py index 63fd81f7..efeeb219 100644 --- a/teleforma/management/commands/teleforma-import-conferences.py +++ b/teleforma/management/commands/teleforma-import-conferences.py @@ -81,11 +81,13 @@ class Command(BaseCommand): path = dir + os.sep + filename collection_id = '_'.join([department_name, course_id, course_type]) - department, c = Department.objects.get_or_create(name=department_name, - organization=organization) - if Conference.objects.filter(public_id=public_id): - conference = Conference.objects.get(public_id=public_id) + department = Department.objects.filter(name=department_name, + organization=organization) + if Conference.objects.filter(public_id=public_id) and department: + conference = Conference.objects.get(public_id=public_id) + department = Department.objects.get(name=department_name, + organization=organization) exist = False medias = conference.media.all() for media in medias: