]> git.parisson.com Git - teleforma.git/commitdiff
re-add conf record rpc methods
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 17 Jul 2013 13:03:34 +0000 (15:03 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 17 Jul 2013 13:03:34 +0000 (15:03 +0200)
teleforma/views/core.py

index f04beb4bd3118fadab02e050d98fa6d8273af333..f98ad0f8afb8b205fd95c3ba7ce8936b0e6f78cf 100644 (file)
@@ -254,6 +254,16 @@ class CourseView(CourseAccessMixin, DetailView):
     def dispatch(self, *args, **kwargs):
         return super(CourseView, self).dispatch(*args, **kwargs)
 
+    @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 MediaView(CourseAccessMixin, DetailView):