From: Guillaume Pellerin Date: Wed, 17 Jul 2013 13:03:34 +0000 (+0200) Subject: re-add conf record rpc methods X-Git-Tag: 1.1~552 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=d309e0fdaa6171e6258ba9be88dab6f868de6090;p=teleforma.git re-add conf record rpc methods --- diff --git a/teleforma/views/core.py b/teleforma/views/core.py index 5366172b..cf5f10e2 100644 --- a/teleforma/views/core.py +++ b/teleforma/views/core.py @@ -258,6 +258,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):