Add view to send PDF letter to EDE expert
This commit is contained in:
parent
84440ceb2a
commit
3b43477e17
7 changed files with 168 additions and 7 deletions
|
|
@ -34,7 +34,7 @@ from .models import (
|
|||
Klass, Section, Option, Student, Teacher, Corporation, CorpContact, Course, Period,
|
||||
Training, Availability,
|
||||
)
|
||||
from .pdf import UpdateDataFormPDF
|
||||
from .pdf import ExpertEDEPDF, UpdateDataFormPDF
|
||||
from .utils import is_int
|
||||
|
||||
|
||||
|
|
@ -909,6 +909,24 @@ def print_update_form(request):
|
|||
return response
|
||||
|
||||
|
||||
def print_pdf_to_expert_ede(request, pk):
|
||||
"""
|
||||
Imprime le PDF à envoyer à l'expert EDE en accompagnement du
|
||||
travail de diplôme
|
||||
"""
|
||||
student = get_object_or_404(Student, pk=pk)
|
||||
if not student.is_examination_valid:
|
||||
messages.error(request, "Toutes les informations ne sont pas disponibles pour la lettre à l’expert!")
|
||||
return redirect(reverse("admin:stages_student_change", args=(student.pk,)))
|
||||
pdf = ExpertEDEPDF(student)
|
||||
pdf.produce(student)
|
||||
|
||||
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'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue