From: Guillaume Pellerin Date: Wed, 29 Jan 2014 13:19:43 +0000 (+0100) Subject: add department to conference import X-Git-Tag: 2.8.1-ae~104 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=eb12f715d4d53bb94fcd27d664891efe25da13a8;p=teleforma.git add department to conference import --- diff --git a/teleforma/management/commands/teleforma-import-conferences.py b/teleforma/management/commands/teleforma-import-conferences.py index fbf24a7f..f1c7d5c3 100644 --- a/teleforma/management/commands/teleforma-import-conferences.py +++ b/teleforma/management/commands/teleforma-import-conferences.py @@ -52,10 +52,13 @@ class Command(BaseCommand): def handle(self, *args, **options): organization_name = args[0] - log_file = args[1] + department_name = args[1] + log_file = args[2] logger = Logger(log_file) organization = Organization.objects.get(name=organization_name) + department = Department.objects.get(name=department_name, + organization=organization) self.media_dir = settings.MEDIA_ROOT + organization.name file_list = [] all_conferences = Conference.objects.all() @@ -81,9 +84,6 @@ class Command(BaseCommand): path = dir + os.sep + filename collection_id = '_'.join([department_name, course_id, course_type]) - 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, @@ -143,8 +143,6 @@ class Command(BaseCommand): media.course_type = conference.course_type media.type = ext media.set_mime_type() - if conference.period: - media.period = conference.period media.save() conference.save() logger.logger.info(path)