Add view to print PDF examination compensation form

This commit is contained in:
Claude Paroz 2018-04-12 14:14:29 +02:00
parent 7d80994587
commit 66cd4b7a8c
5 changed files with 194 additions and 7 deletions

View file

@ -34,7 +34,7 @@ from .models import (
Klass, Section, Option, Student, Teacher, Corporation, CorpContact, Course, Period,
Training, Availability,
)
from .pdf import ExpertEDEPDF, UpdateDataFormPDF
from .pdf import ExaminationCompensationPdfForm, ExpertEDEPDF, UpdateDataFormPDF
from .utils import is_int
@ -927,6 +927,21 @@ def print_pdf_to_expert_ede(request, pk):
return response
def print_examination_compensation_form(request, pk):
"""
Imprime le PDF à envoyer à l'expert EDE en accompagnement du
travail de diplôme
"""
student = Student.objects.get(pk=pk)
pdf = ExaminationCompensationPdfForm(student)
pdf.produce()
with open(pdf.filename, mode='rb') as fh:
response = HttpResponse(fh.read(), content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename="{0}"'.format(os.path.basename(pdf.filename))
return response
GENERAL_EXPORT_FIELDS = [
('Num_Ele', 'ext_id'),
('Nom_Ele', 'last_name'),