periode_pdf_2
This commit is contained in:
parent
776ff9f4fe
commit
83cca59c7e
2 changed files with 12 additions and 8 deletions
12
cms/views.py
12
cms/views.py
|
|
@ -3,10 +3,12 @@ Created on 4 déc. 2012
|
||||||
|
|
||||||
@author: alzo
|
@author: alzo
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
|
|
||||||
from django.views.generic import ListView, TemplateView, DetailView
|
from django.views.generic import ListView, TemplateView, DetailView
|
||||||
from django.db.models import F, Sum
|
from django.db.models import F, Sum
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
from django.conf import settings
|
||||||
from reportlab.platypus import Paragraph, Spacer, Table, TableStyle, Preformatted
|
from reportlab.platypus import Paragraph, Spacer, Table, TableStyle, Preformatted
|
||||||
from reportlab.lib.units import cm
|
from reportlab.lib.units import cm
|
||||||
from reportlab.lib import colors
|
from reportlab.lib import colors
|
||||||
|
|
@ -269,10 +271,12 @@ class ModulePDF(DetailView):
|
||||||
[preformatted_left('Responsable'), preformatted_right(m.processus.domaine.responsable.descr_pdf())],
|
[preformatted_left('Responsable'), preformatted_right(m.processus.domaine.responsable.descr_pdf())],
|
||||||
]
|
]
|
||||||
t = Table(data, colWidths=[2.5*cm, 10*cm])
|
t = Table(data, colWidths=[2.5*cm, 10*cm])
|
||||||
t.setStyle(TableStyle([
|
t.setStyle(
|
||||||
|
TableStyle([
|
||||||
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
|
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
|
||||||
('VALIGN', (0, 0), (-1, -1), 'TOP'),
|
('VALIGN', (0, 0), (-1, -1), 'TOP'),
|
||||||
('LEFTPADDING', (0, 0), (-1, -1), 0), ])
|
('LEFTPADDING', (0, 0), (-1, -1), 0), ]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
t.hAlign = 0
|
t.hAlign = 0
|
||||||
response.story.append(Spacer(0, 1*cm))
|
response.story.append(Spacer(0, 1*cm))
|
||||||
|
|
@ -321,7 +325,7 @@ class PeriodePDFView(TemplateView):
|
||||||
|
|
||||||
def render_to_response(self, context, **response_kwargs):
|
def render_to_response(self, context, **response_kwargs):
|
||||||
context = get_context(context)
|
context = get_context(context)
|
||||||
filename = 'media/periode.pdf'
|
filename = os.path.join(settings.MEDIA_ROOT, 'periode.pdf')
|
||||||
pdf = PeriodPDF(filename)
|
pdf = PeriodPDF(filename)
|
||||||
for semestre_id in range(1, 7):
|
for semestre_id in range(1, 7):
|
||||||
modules = context['sem{0}'.format(str(semestre_id))]
|
modules = context['sem{0}'.format(str(semestre_id))]
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ endobj
|
||||||
<< /Outlines 10 0 R /PageMode /UseNone /Pages 8 0 R /Type /Catalog >>
|
<< /Outlines 10 0 R /PageMode /UseNone /Pages 8 0 R /Type /Catalog >>
|
||||||
endobj
|
endobj
|
||||||
7 0 obj
|
7 0 obj
|
||||||
<< /Author (anonymous) /CreationDate (D:20170814072142-01'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /ModDate (D:20170814072142-01'00') /Producer (ReportLab PDF Library - www.reportlab.com)
|
<< /Author (anonymous) /CreationDate (D:20170814074017-01'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /ModDate (D:20170814074017-01'00') /Producer (ReportLab PDF Library - www.reportlab.com)
|
||||||
/Subject (unspecified) /Title (untitled) /Trapped /False >>
|
/Subject (unspecified) /Title (untitled) /Trapped /False >>
|
||||||
endobj
|
endobj
|
||||||
8 0 obj
|
8 0 obj
|
||||||
|
|
@ -243,7 +243,7 @@ xref
|
||||||
trailer
|
trailer
|
||||||
<< /ID
|
<< /ID
|
||||||
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
||||||
[(\240o\267o\321\233L:\251\3545\212P1\275h) (\240o\267o\321\233L:\251\3545\212P1\275h)]
|
[(\353\211\003\306uO\376\265\357\030\317\244\200\211\306w) (\353\211\003\306uO\376\265\357\030\317\244\200\211\306w)]
|
||||||
/Info 7 0 R /Root 6 0 R /Size 11 >>
|
/Info 7 0 R /Root 6 0 R /Size 11 >>
|
||||||
startxref
|
startxref
|
||||||
98675
|
98675
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue