]> git.parisson.com Git - teleforma.git/commitdiff
add department to conference import
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 29 Jan 2014 13:19:43 +0000 (14:19 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 29 Jan 2014 13:19:43 +0000 (14:19 +0100)
teleforma/management/commands/teleforma-import-conferences.py

index fbf24a7f84d481206e94148dd288ef66c53a5932..f1c7d5c36a3e1142af077db4f4a8495e7c4a6cf6 100644 (file)
@@ -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)