{% endblock %}
<style>
- @page {
- background-image: url({{ STATIC_URL }}teleforma/images/attestation_fifpl_v3.png);
-
- @frame user {
- -pdf-frame-content: user;
+
+@page :first {
+ background: url(https://{{ site.domain }}/{{ STATIC_URL }}teleforma/images/attestation_fifpl_v3.png) no-repeat center;
+ background-size: cover;
+ margin: 0;
+}
+
+ #user {
+ position: absolute;
top: 315px;
- left: 280px;
+ left: 330px;
}
- @frame seminar {
- -pdf-frame-content: seminar;
+ #seminar {
+ position: absolute;
top: 380px;
- left: 110px;
+ left: 160px;
}
- @frame date_start_d {
- -pdf-frame-content: date_start_d;
+ #date_start_d {
+ position: absolute;
top: 412px;
- left: 137px;
+ left: 187px;
}
- @frame date_start_m {
- -pdf-frame-content: date_start_m;
+ #date_start_m {
+ position: absolute;
top: 412px;
- left: 165px;
+ left: 215px;
}
- @frame date_start_y {
- -pdf-frame-content: date_start_y;
+ #date_start_y {
+ position: absolute;
top: 412px;
- left: 192px;
+ left: 242px;
}
- @frame date_end_d {
- -pdf-frame-content: date_end_d;
+ #date_end_d {
+ position: absolute;
top: 412px;
- left: 235px;
+ left: 285px;
}
- @frame date_end_m {
- -pdf-frame-content: date_end_m;
+ #date_end_m {
+ position: absolute;
top: 412px;
- left: 262px;
+ left: 312px;
}
- @frame date_end_y {
- -pdf-frame-content: date_end_y;
+ #date_end_y {
+ position: absolute;
top: 412px;
- left: 290px;
+ left: 340px;
}
- @frame user-hours {
- -pdf-frame-content: user-hours;
+ #user-hours {
+ position: absolute;
top: 445px;
- left: 420px;
+ left: 470px;
}
- @frame seminar-hours {
- -pdf-frame-content: seminar-hours;
+ #seminar-hours {
+ position: absolute;
top: 525px;
- left: 230px;
+ left: 280px;
}
- @frame price-ht {
- -pdf-frame-content: price-ht;
+ #price-ht {
+ position: absolute;
top: 629px;
- left: 390px;
+ left: 440px;
}
- @frame price-ttc {
- -pdf-frame-content: price-ttc;
+ #price-ttc {
+ position: absolute;
top: 644px;
- left: 140px;
+ left: 190px;
}
- @frame date-validated {
- -pdf-frame-content: date-validated;
+ #date-validated {
+ position: absolute;
top: 549px;
- left: 310px;
+ left: 360px;
}
- @frame date-now {
- -pdf-frame-content: date-now;
+ #date-now {
+ position: absolute;
top: 718px;
- left: 270px;
+ left: 320px;
}
-}
</style>
</head>
-<body>
+<body id="seminar_testimonial_payback">
{% block layout %}
<div id="layout">
<div id="content" style="font-size=1.3em;">
"""
src = weasyprint.HTML(string=content.encode(encoding), encoding=encoding)
site = Site.objects.get_current()
- src.write_pdf(dest, stylesheets=[f'https://{site.domain}/{settings.STATIC_URL}teleforma/css/teleforma_pdf.css',])
+ src.write_pdf(dest, stylesheets=[f'https://{site.domain}{settings.STATIC_URL}teleforma/css/teleforma_pdf.css',])
return True
Return the pdf attachment filename.
If the filename is None, the pdf will not be an attachment.
"""
- return str(self.pdf_filename)
+ return self.pdf_filename and str(self.pdf_filename) or "pb.pdf"
def get_pdf_url(self):
"""
model = Seminar
template_name = 'teleforma/seminar_testimonial.html'
pdf_template_name = template_name
+ pdf_filename = 'testimonial.pdf'
def get_context_data(self, **kwargs):
context = super(TestimonialView, self).get_context_data(**kwargs)
context['answers'] = Answer.objects.filter(question__in=seminar.question.all(),
user=self.request.user,
validated=True).order_by('question__rank')
+ context['site'] = Site.objects.get_current()
# user_timer = get_seminar_timer(self.request.user, seminar)
# context['user_timer'] = user_timer.days * 24 + user_timer.seconds / 3600
return context