From b3d9dc74e6915c50c395374b647f8e1a01aa227c Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 22 Jul 2013 10:45:40 +0200 Subject: [PATCH] readd course form api --- teleforma/views/core.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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): -- 2.39.5