]> git.parisson.com Git - teleforma.git/commitdiff
readd course form api
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 22 Jul 2013 08:45:40 +0000 (10:45 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 22 Jul 2013 08:45:40 +0000 (10:45 +0200)
teleforma/views/core.py

index 9ac43937d9d089a9f838d8f5796911b3f6fa8bd8..789477b565128824d4bec9600c9e8f95685ac6bf 100644 (file)
@@ -258,6 +258,16 @@ class CourseListView(CourseAccessMixin, ListView):
                 course = course[0]
             course.from_dict(course_dict)
             
+    @jsonrpc_method('teleforma.get_dep_courses')
+    def get_dep_courses(request, id):
+        department = Department.objects.get(id=id)
+        return [{'id': str(c.id), 'name': unicode(c)} for c in department.course.all()]
+
+    @jsonrpc_method('teleforma.get_dep_periods')
+    def get_dep_periods(request, id):
+        department = Department.objects.get(id=id)
+        return [{'id': str(c.id), 'name': unicode(c)} for c in department.period.all()]
+
 
 class CourseView(CourseAccessMixin, DetailView):