]> git.parisson.com Git - teleforma.git/commitdiff
fix course push/pull
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 17 Sep 2013 16:37:05 +0000 (18:37 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 17 Sep 2013 16:37:05 +0000 (18:37 +0200)
teleforma/views/core.py

index 0c7934d027d4961496dd56bbfe37532dff8c3671..23ccc35d7bd27fa69d9bd06bbeaabf8d19644d8d 100644 (file)
@@ -239,8 +239,9 @@ class CourseListView(CourseAccessMixin, ListView):
         return super(CourseListView, self).dispatch(*args, **kwargs)
 
     @jsonrpc_method('teleforma.get_course_list')
-    def get_course_list(request, department_id):
-        department = Department.objects.get(id=department_id)
+    def get_course_list(request, organization_name, department_name):
+        organization = Organization.objects.get(name=organization_name)
+        department = Department.objects.get(organization=organization, name=department_name)
         return [course.to_dict() for course in Course.objects.filter(department=department)]
 
     def pull(request, organization_name, department_name):
@@ -249,7 +250,7 @@ class CourseListView(CourseAccessMixin, ListView):
         url = 'http://' + department.domain + '/json/'
         s = ServiceProxy(url)
 
-        remote_list = s.teleforma.get_course_list(organization.name, department.name)
+        remote_list = s.teleforma.get_course_list(organization_name, department.name)
         for course_dict in remote_list['result']:
             course = Course.objects.filter(code=course_dict['code'])
             if not course: