]> git.parisson.com Git - teleforma.git/commitdiff
add a second detail testimonial for seminar
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 12 Jun 2013 08:24:29 +0000 (10:24 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 12 Jun 2013 08:24:29 +0000 (10:24 +0200)
teleforma/templates/teleforma/seminar_testimonial.html
teleforma/templates/teleforma/seminar_testimonial_presence.html [new file with mode: 0644]
teleforma/urls.py
teleforma/views/pro.py

index 4030998f223ea21a26593cf90488b859f0eea127..52851777c685f452b04094891a99e92b4804ca5d 100644 (file)
@@ -34,7 +34,7 @@
       <tr><td class="bold">{% trans "Last name" %} : </td><td>{{ testimonial.user.last_name|upper }}</td></tr>
       <tr><td class="bold">{% trans "First name" %} : </td><td>{{ testimonial.user.first_name|upper }}</td></tr>
       <tr><td class="bold">{% trans "Address" %} : </td><td>{{ testimonial.user.auditor.all.0.address }} {{ testimonial.user.auditor.all.0.postal_code }} {{ testimonial.user.auditor.all.0.city }}</td></tr>
-      <tr><td class="bold">{% trans "Sujet" %} : </td><td>{{ seminar.title }}</td></tr>
+      <tr><td class="bold">{% trans "Subject" %} : </td><td>{{ seminar.title }}</td></tr>
       <tr><td class="bold">{% trans "Course" %} : </td><td>{{ seminar.course }}</td></tr>
       <tr><td class="bold">{% trans "Training type" %} : </td><td>E-learning</td></tr>
       <tr><td class="bold">{% trans "Duration" %} : </td><td>{{ seminar.duration|hours }} {% trans "hours" %}</td></tr>
diff --git a/teleforma/templates/teleforma/seminar_testimonial_presence.html b/teleforma/templates/teleforma/seminar_testimonial_presence.html
new file mode 100644 (file)
index 0000000..ef8d254
--- /dev/null
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+{% load i18n %}
+{% load telemeta_utils %}
+{% load teleforma_tags %}
+
+{% get_current_language as LANGUAGE_CODE %}
+{% get_available_languages as LANGUAGES %}
+<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_CODE }}" xml:lang="{{ LANGUAGE_CODE }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
+
+<head>
+<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
+
+<title>{%block head_title %}{% description %} - {% trans "Testimonial" %}{% endblock %}</title>
+
+{% block stylesheets %}
+<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}teleforma/css/teleforma_pdf.css" />
+{% endblock %}
+
+{% block extra_stylesheets %}{% endblock %}
+
+</head>
+
+<body>
+{% block layout %}
+<div id="layout">
+
+<div id="header">
+    <span style="color: yellow; font-weight: bold;">&gt;</span> {% trans "Remote presence testimonial" %}
+</div>
+
+<div id="content">
+
+   <table class="table1">
+      <tr><td class="bold">{% trans "Last name" %} : </td><td>{{ testimonial.user.last_name|upper }}</td></tr>
+      <tr><td class="bold">{% trans "First name" %} : </td><td>{{ testimonial.user.first_name|upper }}</td></tr>
+      <tr><td class="bold">{% trans "Address" %} : </td><td>{{ testimonial.user.auditor.all.0.address }} {{ testimonial.user.auditor.all.0.postal_code }} {{ testimonial.user.auditor.all.0.city }}</td></tr>
+      <tr><td class="bold">{% trans "Subject" %} : </td><td>{{ seminar.title }}</td></tr>
+      <tr><td class="bold">{% trans "Course" %} : </td><td>{{ seminar.course }}</td></tr>
+      <tr><td class="bold">{% trans "Duration" %} : </td><td>{{ seminar.duration|hours }} {% trans "hours" %}</td></tr>
+      <tr><td class="bold">{% trans "Validation mode of the training" %} : </td><td>{% trans "Reply to questions" %}</td></tr>
+      <tr><td class="bold">{% trans "Training begin date" %} : </td><td>{{ first_revision.date|date:'j F Y' }}</td></tr>
+      <tr><td class="bold">{% trans "Knowledge validation dates" %} : </td><td></td></tr>
+      {% for answer in answers %}<tr><td style="padding-left:10px;">{% trans "Answer" %} n°{{ answer.question.rank }} : </td><td>{{ answer.date_validated|date:'j F Y' }}</td></tr>{% endfor %}
+      <tr><td class="bold">{% trans "Training end date" %} : </td><td>{% if testimonial.date_modified %}{{ testimonial.date_modified|date:'j F Y' }}{% else %}{{ testimonial.date_added|date:'j F Y' }}{% endif %}</td></tr>
+    </table>
+
+    <table class="table2">
+      <tr><td>
+        {{ seminar.course.department.address|safe }}
+      </td>
+      <td>
+        <img src="{{ seminar.course.department.signature.url }}" title="Pro-Barreau signature" alt="Pro-Barreau signature" />
+      </td></tr>
+    </table>
+
+</div>
+
+{% block footer %}
+<div id="footer">
+    Copyright &copy; {% current_year %} {{ seminar.course.department }}
+ </div>
+{% endblock %}
+
+</div>
+{% endblock layout %}
+
+</body>
+</html>
index 596dc94c7821d47cc26ecebe60d6261a16f64c8a..3bd0abfab87c10461de208ed5c55b144ca50d990 100644 (file)
@@ -111,6 +111,8 @@ urlpatterns = patterns('',
                                                     name="teleforma-seminar-testimonial-download"),
     url(r'^desk/testimonials/$', TestimonialListView.as_view(),
                                                     name="teleforma-testimonials"),
+    url(r'^desk/seminars/(?P<pk>.*)/testimonial-presence/$', TestimonialPresenceView.as_view(),
+                                                    name="teleforma-seminar-testimonial-presence"),
 
     # Postman
     url(r'^messages/', include('postman.urls')),
index aedd4e58524aab709b95dc7446681e8a220a5a02..0a195609529a32286abf992d98b605105824e9a3 100644 (file)
@@ -603,8 +603,7 @@ class TestimonialView(PDFTemplateResponseMixin, SeminarView):
     context_object_name = "seminar"
     model = Seminar
     template_name = 'teleforma/seminar_testimonial.html'
-    pdf_template_name = 'teleforma/seminar_testimonial.html'
-    # pdf_filename = 'report.pdf'
+    pdf_template_name = template_name
 
     def get_context_data(self, **kwargs):
         context = super(TestimonialView, self).get_context_data(**kwargs)
@@ -655,3 +654,20 @@ class TestimonialListView(ListView):
     def dispatch(self, *args, **kwargs):
         return super(TestimonialListView, self).dispatch(*args, **kwargs)
 
+
+class TestimonialPresenceView(TestimonialView):
+
+    template_name = 'teleforma/seminar_testimonial_presence.html'
+    pdf_template_name = template_name
+
+    def get_context_data(self, **kwargs):
+        context = super(TestimonialPresenceView, self).get_context_data(**kwargs)
+        seminar = context['seminar']
+        context['answers'] = Answer.objects.filter(question__in=seminar.question.all(),
+                                                   user=self.request.user,
+                                                   validated=True).order_by('question__rank')
+        return context
+
+    @method_decorator(login_required)
+    def dispatch(self, *args, **kwargs):
+        return super(TestimonialPresenceView, self).dispatch(*args, **kwargs)