mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
feat: Gestion des profils des enseignants / Visualisation d'une classe [#4]
This commit is contained in:
@ -179,3 +179,23 @@ def getArgFromRequest(_argument, _request):
|
||||
data=JSONParser().parse(_request)
|
||||
resultat = data[_argument]
|
||||
return resultat
|
||||
|
||||
def diToPDF(ficheEleve):
|
||||
# Ajout du fichier d'inscriptions
|
||||
data = {
|
||||
'pdf_title': "Dossier d'inscription de %s"%ficheEleve.eleve.prenom,
|
||||
'dateSignature': convertToStr(_now(), '%d-%m-%Y'),
|
||||
'heureSignature': convertToStr(_now(), '%H:%M'),
|
||||
'eleve':ficheEleve.eleve,
|
||||
}
|
||||
|
||||
pdf = renderers.render_to_pdf('pdfs/dossier_inscription.html', data)
|
||||
|
||||
nomFichierPDF = "Dossier_Inscription_%s_%s.pdf"%(ficheEleve.eleve.nom, ficheEleve.eleve.prenom)
|
||||
pathFichier = Path(settings.DOCUMENT_DIR + "/" + nomFichierPDF)
|
||||
if os.path.exists(str(pathFichier)):
|
||||
print(f'File exists : {str(pathFichier)}')
|
||||
os.remove(str(pathFichier))
|
||||
|
||||
receipt_file = BytesIO(pdf.content)
|
||||
ficheEleve.fichierInscription = File(receipt_file, nomFichierPDF)
|
||||
Reference in New Issue
Block a user