From 879cbe9c542a33aa939868ff8fe5011d67077680 Mon Sep 17 00:00:00 2001 From: yomguy Date: Thu, 20 Dec 2012 13:16:04 +0100 Subject: [PATCH] add testimonial links and filename --- .../teleforma/inc/testimonial_list.html | 22 +++++++++++++++++++ .../templates/teleforma/seminar_detail.html | 4 ++++ teleforma/urls.py | 3 ++- teleforma/views/pro.py | 17 +++++++++++++- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 teleforma/templates/teleforma/inc/testimonial_list.html diff --git a/teleforma/templates/teleforma/inc/testimonial_list.html b/teleforma/templates/teleforma/inc/testimonial_list.html new file mode 100644 index 00000000..e5ccb490 --- /dev/null +++ b/teleforma/templates/teleforma/inc/testimonial_list.html @@ -0,0 +1,22 @@ +{% load teleforma_tags %} +{% load i18n %} + +
+ +
+

{{ title }}

+
+ + + + + + + + + + +
{% trans "Testimonial" %} : {{ seminar.title }}{% if seminar.rank %} n°{{seminar.rank}}{% endif %}
+ +
+ diff --git a/teleforma/templates/teleforma/seminar_detail.html b/teleforma/templates/teleforma/seminar_detail.html index 64e96592..2a8841f9 100644 --- a/teleforma/templates/teleforma/seminar_detail.html +++ b/teleforma/templates/teleforma/seminar_detail.html @@ -142,6 +142,10 @@ $(function() { {% endwith %} {% endwith %} + {% with _("Step 7 : download your testimonial") as title %} + {% include "teleforma/inc/testimonial_list.html" %} + {% endwith %} + {% endif %} {% endblock course_content %} diff --git a/teleforma/urls.py b/teleforma/urls.py index 87406de0..d40884e7 100644 --- a/teleforma/urls.py +++ b/teleforma/urls.py @@ -47,7 +47,6 @@ user_export = UsersXLSExport() profile_view = ProfileView() document = DocumentView() media = MediaView() -testimonial = TestimonialView() urlpatterns = patterns('', # url(r'^$', HomeView.as_view(), name='teleforma-home'), @@ -107,6 +106,8 @@ urlpatterns = patterns('', # Testimonial url(r'^desk/seminars/(?P.*)/testimonial/$', TestimonialView.as_view(), name="teleforma-seminar-testimonial"), + url(r'^desk/seminars/(?P.*)/testimonial/download/$', TestimonialDownloadView.as_view(), + name="teleforma-seminar-testimonial-download"), # Postman url(r'^messages/', include('postman.urls')), diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index 1d71238b..392856a3 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -547,9 +547,24 @@ class TestimonialView(PDFTemplateResponseMixin, SeminarView): @method_decorator(login_required) def dispatch(self, *args, **kwargs): return super(TestimonialView, self).dispatch(*args, **kwargs) - + def get_context_data(self, **kwargs): context = super(TestimonialView, self).get_context_data(**kwargs) context['seminar'] = self.get_object() return context + +class TestimonialDownloadView(TestimonialView): + + pdf_filename = 'testimonial.pdf' + + def get_pdf_filename(self): + super(TestimonialView, self).get_pdf_filename() + seminar = self.get_object() + prefix = unicode(_('Testimonial')) + filename = '_'.join([prefix, seminar.title, + self.request.user.first_name, self.request.user.last_name,]) + filename += '.pdf' + return filename.encode('utf-8') + + -- 2.39.5