index_pdf

This commit is contained in:
alazo 2017-01-31 15:29:44 +01:00
parent bb96f7d517
commit 0a04b08308
4 changed files with 19 additions and 16 deletions

View file

@ -176,12 +176,12 @@ class PDFResponse(HttpResponse):
self['Content-Disposition'] = 'attachment; filename={0}'.format(filename) self['Content-Disposition'] = 'attachment; filename={0}'.format(filename)
self['Content-Type'] = 'charset=utf-8' self['Content-Type'] = 'charset=utf-8'
self.story = [] self.story = []
image = Image(settings.MEDIA_ROOT + '/media/header.png', width=499, height=99) image = Image(settings.MEDIA_ROOT + '/media/header.png', width=480, height=80)
image.hAlign = 0 image.hAlign = 0
self.story.append(image) self.story.append(image)
self.story.append(Spacer(0,1*cm)) #self.story.append(Spacer(0,1*cm))
data = [['Filières EDS', title]] data = [['Filières EDS', title]]
if portrait: if portrait:

View file

@ -70,7 +70,7 @@ class HomwPDFView(TemplateView):
[Preformatted(d[7].__str__(), style_normal, maxLineLength=40), Preformatted(p[10].__str__(), style_normal, maxLineLength=60) , 'Macc' , '' ,'' , '' , '' , '' ], [Preformatted(d[7].__str__(), style_normal, maxLineLength=40), Preformatted(p[10].__str__(), style_normal, maxLineLength=60) , 'Macc' , '' ,'' , '' , '' , '' ],
] ]
t = Table(data, colWidths=[5.5*cm, 8*cm, 1.5*cm, 1.5*cm,1.5*cm, 1.5*cm,1.5*cm,1.5*cm], spaceBefore=1*cm, spaceAfter=1*cm) t = Table(data, colWidths=[5.5*cm, 8*cm, 1.5*cm, 1.5*cm,1.5*cm, 1.5*cm,1.5*cm,1.5*cm], spaceBefore=0.5*cm, spaceAfter=1*cm)
t.setStyle(TableStyle([ t.setStyle(TableStyle([
('SIZE', (0,0), (-1,-1), 8), ('SIZE', (0,0), (-1,-1), 8),
('FONT', (0,0), (-1,0), 'Helvetica-Bold'), ('FONT', (0,0), (-1,0), 'Helvetica-Bold'),
@ -323,7 +323,7 @@ class PeriodePDFView(TemplateView):
t.hAlign = 0 t.hAlign = 0
response.story.append(t) response.story.append(t)
response.story.append(Paragraph('Total des heures de cours: {0} h.'.format(context['tot']), style_normal)) response.story.append(Paragraph('Total des heures de cours: {0} heures'.format(context['tot']), style_normal))
doc = MyDocTemplate(response) doc = MyDocTemplate(response)
doc.build(response.story) doc.build(response.story)

View file

@ -80,8 +80,8 @@
<td class="l6 d">{{D6.url|safe}}</td> <td class="l6 d">{{D6.url|safe}}</td>
<td class="l6 p">{{P09.url|safe}}</td> <td class="l6 p">{{P09.url|safe}}</td>
<td colspan="2" class="l6 m">{{M16_1.url_code|safe}}</td> <td colspan="2" class="l6 m">{{M16_1.url_code|safe}}</td>
<td colspan="2" class="l6 m">{{M16_2a.url_code|safe}} / {{M16_2b.url_code|safe}} / {{M16_2c.url_code|safe}}</td> <td colspan="2" class="l6 m">{{M16_2.url_code|safe}}</td>
<td colspan="2" class="l6 m">{{M16_3a.url_code|safe}} / {{M16_3b.url_code|safe}} / {{M16_3c.url_code|safe}}</td> <td colspan="2" class="l6 m">{{M16_3.url_code|safe}}</td>
</tr> </tr>
<!-- Ligne 7 --> <!-- Ligne 7 -->
<tr> <tr>

View file

@ -9,39 +9,42 @@
<div id="content-main"> <div id="content-main">
<h1>Périodes de formation</h1> <h1>Périodes de formation</h1>
<table> <table>
<tr><th width="275px">Semestre 1</th><th text-align="right">{{tot1.sem1__sum}}h.</th><th width="275px">Semestre 2</th><th text-align="right">{{tot2.sem2__sum}}h.</th></tr> <tr><th width="290px">Semestre 1</th><th text-align="right">{{tot1.sem1__sum}}h.</th><th width="40px"></th><th width="290px">Semestre 2</th><th text-align="right">{{tot2.sem2__sum}}h.</th></tr>
<tr><td colspan="2"><table> <tr><td colspan="2"><table align="right">
{% for s in sem1 %} {% for s in sem1 %}
<tr><td>{{s}}</td><td>{{s.sem1}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem1}} h.</td></tr>
{% endfor %} {% endfor %}
</table> </table>
</td> </td>
<td></td>
<td colspan="2"> <td colspan="2">
<table> <table align="right">
{% for s in sem2 %} {% for s in sem2 %}
<tr><td>{{s}}</td><td>{{s.sem2}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem2}} h.</td></tr>
{% endfor %} {% endfor %}
</table> </table>
</td></tr> </td></tr>
<tr><th>Semestre 3</th><th text-align="right">{{tot3.sem3__sum}}h.</th><th>Semestre 4</th><th text-align="right">{{tot4.sem4__sum}}h.</th> </tr> <tr><th>Semestre 3</th><th text-align="right">{{tot3.sem3__sum}}h.</th><th></th><th>Semestre 4</th><th text-align="right">{{tot4.sem4__sum}}h.</th> </tr>
<tr><td colspan="2"><table> <tr><td colspan="2"><table align="right">
{% for s in sem3 %} {% for s in sem3 %}
<tr><td>{{s}}</td><td>{{s.sem3}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem3}} h.</td></tr>
{% endfor %} {% endfor %}
</table></td> </table></td>
<td colspan="2"><table> <td></td>
<td colspan="2"><table align="right">
{% for s in sem4 %} {% for s in sem4 %}
<tr><td>{{s}}</td><td>{{s.sem4}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem4}} h.</td></tr>
{% endfor %} {% endfor %}
</table></td></tr> </table></td></tr>
<tr><th>Semestre 5</th><th text-align="right">{{tot5.sem5__sum}}h.</th><th>Semestre 6</th><th text-align="right">{{tot6.sem6__sum}}h.</th></tr> <tr><th>Semestre 5</th><th text-align="right">{{tot5.sem5__sum}}h.</th><th></th><th>Semestre 6</th><th text-align="right">{{tot6.sem6__sum}}h.</th></tr>
<tr><td colspan="2"><table> <tr><td colspan="2"><table align="right">
{% for s in sem5 %} {% for s in sem5 %}
<tr><td>{{s}}</td><td>{{s.sem5}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem5}} h.</td></tr>
{% endfor %} {% endfor %}
</table></td> </table></td>
<td></td>
<td colspan="2"> <td colspan="2">
<table> <table align="right">
{% for s in sem6 %} {% for s in sem6 %}
<tr><td>{{s}}</td><td>{{s.sem6}} h.</td></tr> <tr><td>{{s}}</td><td>{{s.sem6}} h.</td></tr>
{% endfor %} {% endfor %}
@ -50,7 +53,7 @@
</table> </table>
<br/> <br/>
Total des périodes de cours: {{tot}} heures Total des heures de cours: {{tot}} heures
<br/><br/> <br/><br/>
<a href="{% url 'periodes-pdf' %}">Imprimer en PDF</a> <a href="{% url 'periodes-pdf' %}">Imprimer en PDF</a>