From 0a0e0f915b7a8db4b38239bda2b994227af54b22 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Wed, 12 Jun 2013 10:24:29 +0200 Subject: [PATCH] add a second detail testimonial for seminar --- .../teleforma/seminar_testimonial.html | 2 +- .../seminar_testimonial_presence.html | 68 +++++++++++++++++++ teleforma/urls.py | 2 + teleforma/views/pro.py | 20 +++++- 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 teleforma/templates/teleforma/seminar_testimonial_presence.html diff --git a/teleforma/templates/teleforma/seminar_testimonial.html b/teleforma/templates/teleforma/seminar_testimonial.html index 4030998f..52851777 100644 --- a/teleforma/templates/teleforma/seminar_testimonial.html +++ b/teleforma/templates/teleforma/seminar_testimonial.html @@ -34,7 +34,7 @@ {% trans "Last name" %} : {{ testimonial.user.last_name|upper }} {% trans "First name" %} : {{ testimonial.user.first_name|upper }} {% trans "Address" %} : {{ testimonial.user.auditor.all.0.address }} {{ testimonial.user.auditor.all.0.postal_code }} {{ testimonial.user.auditor.all.0.city }} - {% trans "Sujet" %} : {{ seminar.title }} + {% trans "Subject" %} : {{ seminar.title }} {% trans "Course" %} : {{ seminar.course }} {% trans "Training type" %} : E-learning {% trans "Duration" %} : {{ seminar.duration|hours }} {% trans "hours" %} diff --git a/teleforma/templates/teleforma/seminar_testimonial_presence.html b/teleforma/templates/teleforma/seminar_testimonial_presence.html new file mode 100644 index 00000000..ef8d2548 --- /dev/null +++ b/teleforma/templates/teleforma/seminar_testimonial_presence.html @@ -0,0 +1,68 @@ + +{% load i18n %} +{% load telemeta_utils %} +{% load teleforma_tags %} + +{% get_current_language as LANGUAGE_CODE %} +{% get_available_languages as LANGUAGES %} + + + + + +{%block head_title %}{% description %} - {% trans "Testimonial" %}{% endblock %} + +{% block stylesheets %} + +{% endblock %} + +{% block extra_stylesheets %}{% endblock %} + + + + +{% block layout %} +
+ + + +
+ + + + + + + + + + + + {% for answer in answers %}{% endfor %} + +
{% trans "Last name" %} : {{ testimonial.user.last_name|upper }}
{% trans "First name" %} : {{ testimonial.user.first_name|upper }}
{% trans "Address" %} : {{ testimonial.user.auditor.all.0.address }} {{ testimonial.user.auditor.all.0.postal_code }} {{ testimonial.user.auditor.all.0.city }}
{% trans "Subject" %} : {{ seminar.title }}
{% trans "Course" %} : {{ seminar.course }}
{% trans "Duration" %} : {{ seminar.duration|hours }} {% trans "hours" %}
{% trans "Validation mode of the training" %} : {% trans "Reply to questions" %}
{% trans "Training begin date" %} : {{ first_revision.date|date:'j F Y' }}
{% trans "Knowledge validation dates" %} :
{% trans "Answer" %} n°{{ answer.question.rank }} : {{ answer.date_validated|date:'j F Y' }}
{% trans "Training end date" %} : {% if testimonial.date_modified %}{{ testimonial.date_modified|date:'j F Y' }}{% else %}{{ testimonial.date_added|date:'j F Y' }}{% endif %}
+ + + + +
+ {{ seminar.course.department.address|safe }} + + Pro-Barreau signature +
+ +
+ +{% block footer %} + +{% endblock %} + +
+{% endblock layout %} + + + diff --git a/teleforma/urls.py b/teleforma/urls.py index 596dc94c..3bd0abfa 100644 --- a/teleforma/urls.py +++ b/teleforma/urls.py @@ -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.*)/testimonial-presence/$', TestimonialPresenceView.as_view(), + name="teleforma-seminar-testimonial-presence"), # Postman url(r'^messages/', include('postman.urls')), diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index aedd4e58..0a195609 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -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) -- 2.39.5