From 29da4e425c4a429c66b9492b291bd64e7bfee847 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Wed, 25 Jun 2014 17:03:23 +0200 Subject: [PATCH] Only user courses for scrpt course choice --- teleforma/exam/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/teleforma/exam/views.py b/teleforma/exam/views.py index 38e675e4..de0ddc83 100644 --- a/teleforma/exam/views.py +++ b/teleforma/exam/views.py @@ -118,6 +118,8 @@ class ScriptCreateView(CreateView): context = super(ScriptCreateView, self).get_context_data(**kwargs) context['period'] = Period.objects.get(id=self.kwargs['period_id']) context['create_fields'] = ['course', 'session', 'type', 'file' ] + course_pk_list = [c['course'].id for c in get_courses(self.request.user)] + context['form'].fields['course'].queryset = Course.objects.filter(pk__in=course_pk_list) return context @method_decorator(login_required) -- 2.39.5