Fix obálek #45
1 changed files with 7 additions and 8 deletions
|
@ -575,7 +575,7 @@ def obalkyView(request, resitele):
|
||||||
|
|
||||||
tex = render(request,'seminar/archiv/obalky.tex', {'resitele': resitele}).content
|
tex = render(request,'seminar/archiv/obalky.tex', {'resitele': resitele}).content
|
||||||
|
|
||||||
tempdir = tempfile.mkdtemp()
|
with tempfile.TemporaryDirectory() as tempdir:
|
||||||
with open(tempdir+"/obalky.tex","w") as texfile:
|
with open(tempdir+"/obalky.tex","w") as texfile:
|
||||||
texfile.write(tex.decode())
|
texfile.write(tex.decode())
|
||||||
shutil.copy(find('seminar/lisak.pdf'), tempdir)
|
shutil.copy(find('seminar/lisak.pdf'), tempdir)
|
||||||
|
@ -583,7 +583,6 @@ def obalkyView(request, resitele):
|
||||||
|
|
||||||
with open(tempdir+"/obalky.pdf","rb") as pdffile:
|
with open(tempdir+"/obalky.pdf","rb") as pdffile:
|
||||||
response = HttpResponse(pdffile.read(), content_type='application/pdf')
|
response = HttpResponse(pdffile.read(), content_type='application/pdf')
|
||||||
shutil.rmtree(tempdir)
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue