]> git.parisson.com Git - teleforma.git/commitdiff
no auto department creation
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 6 Feb 2013 10:24:45 +0000 (11:24 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 6 Feb 2013 10:24:45 +0000 (11:24 +0100)
teleforma/management/commands/teleforma-broadcast-message.py
teleforma/management/commands/teleforma-import-conferences.py

index c2628ab3e50be7a95638bcd234783a8e3d20c3c2..01fcf726ec5a6723be5178b374c88e35b39bf63d 100644 (file)
@@ -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)
index 63fd81f739787769216790c64dac737eeab85e2a..efeeb219a23d45c3be11d2e3822c3452f7747a13 100644 (file)
@@ -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: