]> git.parisson.com Git - teleforma.git/commitdiff
Only user courses for scrpt course choice
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 25 Jun 2014 15:03:23 +0000 (17:03 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 25 Jun 2014 15:03:23 +0000 (17:03 +0200)
teleforma/exam/views.py

index 38e675e47e6ced7cd79c187765075d0c320e805f..de0ddc830aff652826175bc70ede1c43f1456838 100644 (file)
@@ -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)