]> git.parisson.com Git - teleforma.git/commitdiff
Filter script form by allowed course
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 4 Jul 2017 23:31:17 +0000 (01:31 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Tue, 4 Jul 2017 23:31:17 +0000 (01:31 +0200)
teleforma/exam/views.py
teleforma/models/core.py

index dc6560ee645ea607b805bb06b8fd1a105d5ddcda..4de61a3d3cb1652addd27050c8a4dd4ffdd39c67 100644 (file)
@@ -184,7 +184,7 @@ class ScriptCreateView(ScriptMixinView, CreateView):
     def get_context_data(self, **kwargs):
         context = super(ScriptCreateView, self).get_context_data(**kwargs)
         context['create_fields'] = ['course', 'session', 'type', 'file' ]
-        course_pk_list = [c['course'].id for c in get_courses(self.request.user)]
+        course_pk_list = [c['course'].id for c in get_courses(self.request.user) if c.exam_scripts]
         context['form'].fields['course'].queryset = Course.objects.filter(pk__in=course_pk_list)
         return context
 
index 81cd02b7df36d02c03a3508d094de814bea7c5dc..dbe2cad27c97df0ec039c8b5e28c5a15cc47a08d 100644 (file)
@@ -160,22 +160,23 @@ class CourseType(Model):
 
 class Course(Model):
 
-    department      = models.ForeignKey('Department', related_name='course',
+    department = models.ForeignKey('Department', related_name='course',
                                  verbose_name=_('department'))
-    title           = models.CharField(_('title'), max_length=255)
-    description     = models.CharField(_('description'), max_length=255, blank=True)
-    code            = models.CharField(_('code'), max_length=255)
-    title_tweeter   = models.CharField(_('tweeter title'), max_length=255)
-    date_modified   = models.DateTimeField(_('date modified'), auto_now=True, null=True)
-    number          = models.IntegerField(_('number'), blank=True, null=True)
-    synthesis_note  = models.BooleanField(_('synthesis note'))
-    obligation      = models.BooleanField(_('obligations'))
-    magistral       = models.BooleanField(_('magistral'))
+    title = models.CharField(_('title'), max_length=255)
+    description = models.CharField(_('description'), max_length=255, blank=True)
+    code = models.CharField(_('code'), max_length=255)
+    title_tweeter = models.CharField(_('tweeter title'), max_length=255)
+    date_modified = models.DateTimeField(_('date modified'), auto_now=True, null=True)
+    number = models.IntegerField(_('number'), blank=True, null=True)
+    synthesis_note = models.BooleanField(_('synthesis note'))
+    obligation = models.BooleanField(_('obligations'))
+    magistral = models.BooleanField(_('magistral'))
     procedure = models.BooleanField(_('procedure'))
     written_speciality = models.BooleanField(_('written_speciality'))
     oral_speciality = models.BooleanField(_('oral_speciality'))
     oral_1 = models.BooleanField(_('oral_1'))
     oral_2 = models.BooleanField(_('oral_2'))
+    exam_scripts = models.BooleanField(_("copies d'examen"), default=True)
 
     def __unicode__(self):
         return self.title