From: Guillaume Pellerin Date: Wed, 25 Jun 2014 15:03:23 +0000 (+0200) Subject: Only user courses for scrpt course choice X-Git-Tag: 1.1~460 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=29da4e425c4a429c66b9492b291bd64e7bfee847;p=teleforma.git Only user courses for scrpt course choice --- 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)