From: Guillaume Pellerin Date: Mon, 22 Jul 2013 08:45:40 +0000 (+0200) Subject: readd course form api X-Git-Tag: 1.1~534 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b3d9dc74e6915c50c395374b647f8e1a01aa227c;p=teleforma.git readd course form api --- diff --git a/teleforma/views/core.py b/teleforma/views/core.py index 9ac43937..789477b5 100644 --- a/teleforma/views/core.py +++ b/teleforma/views/core.py @@ -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):