]> git.parisson.com Git - teleforma.git/commitdiff
add topics to scripts
authorGuillaume Pellerin <yomguy@parisson.com>
Sat, 14 Jun 2014 00:10:31 +0000 (02:10 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Sat, 14 Jun 2014 00:10:31 +0000 (02:10 +0200)
example/settings.py
teleforma/exam/templates/exam/script_detail.html
teleforma/exam/views.py

index a0110c81fd9de1a1fba21dd509929dbd839d6be1..72df9b5d97022f752326d5e4510bb3db5f17fdd2 100644 (file)
@@ -198,7 +198,7 @@ TELECASTER_MASTER_SERVER = 'angus.parisson.com'
 TELEFORMA_E_LEARNING_TYPE = 'CRFPA'
 TELEFORMA_GLOBAL_TWEETER = False
 TELEFORMA_PERIOD_TWEETER = True
-TELEFORMA_EXAM_DEFAULT_DOCUMENT_TYPE = 2
+TELEFORMA_EXAM_DEFAULT_DOCUMENT_TYPE_NUMBER = 2
 
 JQCHAT_DISPLAY_COUNT = 50
 JQCHAT_DISPLAY_TIME  = 48
index e973967025e5c564f603e7e62ac3e9c22c295281..a064299f74b295949e20ce140178a422fc0394cc 100644 (file)
@@ -88,7 +88,9 @@
     <a href="{% url teleforma-desk-period-course period.id script.course.id %}">{{ script.title }}</a>
 
     <div style="float: right; font-size: 0.9em;">
-
+        {% if topic.file %}
+        <a id="topic" href="{% url teleforma-document-download topic.id %}" class="component_icon button icon_download">{% trans "Topic" %}</a>
+        {% endif %}
         {% if script.score %}
         <a id="score" href="#" class="component_icon button icon_ok">{% trans "Score" %} : {{ script.score|floatformat }}/20</a>
         <a id="opener_comments" href="#" class="component_icon button icon_ok">{% trans "Comments" %}</a>
index 20d139872479702647bac6d8d26c3016532e2ba7..9fb0c55b4503593952e73cebc6019c73e2507224 100644 (file)
@@ -23,6 +23,10 @@ class ScriptView(CourseAccessMixin, UpdateView):
         context['mark_fields'] = ['score', 'comments' ]
         context['reject_fields'] = ['reject_reason' ]
 
+        doc_type = DocumentType.objects.get(number=settings.TELEFORMA_EXAM_DEFAULT_DOCUMENT_TYPE_NUMBER)
+        topics = Document.objects.filter(course=script.course, period=script.period,
+                                            session=script.session, type=doc_type)
+        context['topic'] = topics[0]
         access = self.request.user == script.author or \
                     self.request.user == script.corrector or \
                     self.request.user.is_superuser or \