|
@ -79,7 +79,8 @@ def soustredeniStvrzenkyView(request, soustredeni): |
|
|
castka = Nastaveni.get_solo().cena_sous |
|
|
castka = Nastaveni.get_solo().cena_sous |
|
|
tex = render(request, 'soustredeni/stvrzenky.tex', {'ucastnici': ucastnici, 'soustredeni': soustredeni, 'castka': castka}).content |
|
|
tex = render(request, 'soustredeni/stvrzenky.tex', {'ucastnici': ucastnici, 'soustredeni': soustredeni, 'castka': castka}).content |
|
|
|
|
|
|
|
|
tempdir = Path(tempfile.mkdtemp()) |
|
|
with tempfile.TemporaryDirectory() as tempdirfn: |
|
|
|
|
|
tempdir = Path(tempdirfn) |
|
|
with open(tempdir / "stvrzenky.tex", "w") as texfile: |
|
|
with open(tempdir / "stvrzenky.tex", "w") as texfile: |
|
|
texfile.write(tex.decode()) |
|
|
texfile.write(tex.decode()) |
|
|
|
|
|
|
|
@ -88,5 +89,4 @@ def soustredeniStvrzenkyView(request, soustredeni): |
|
|
|
|
|
|
|
|
with open(tempdir / "stvrzenky.pdf", "rb") as pdffile: |
|
|
with open(tempdir / "stvrzenky.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 |
|
|