]> git.parisson.com Git - teleforma.git/commitdiff
fix department
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 7 Mar 2023 14:48:12 +0000 (15:48 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 7 Mar 2023 14:48:12 +0000 (15:48 +0100)
teleforma/views/core.py

index 18e4a01752dd645124a26b2d308fd1807d424391..515815ad6941651876d4dc03a37d082e6d2026d9 100644 (file)
@@ -259,11 +259,13 @@ class CourseListView(CourseAccessMixin, ListView):
             url = 'https://' + department.domain + '/json/'
             s = ServiceProxy(url)
 
-            department_courses = Course.objects.filter(department=department)
             remote_list = s.teleforma.get_course_list(organization_name, department.name)
             if remote_list['result']:
                 for course_dict in remote_list['result']:
-                    course, c = department_courses.get_or_create(code=course_dict['code'])
+                    course, c = Course.objects.get_or_create(
+                                    code=course_dict['code'],
+                                    department=department,
+                                )
                     course.from_dict(course_dict)
                     courses_new.append(course)
                     print(course)