Created new models to replicate out of and split coord app

Moved helpers and views to their respective new apps
This commit is contained in:
st01765
2026-02-05 11:18:08 +11:00
parent ad4fd19cc7
commit b695dd8054
26 changed files with 1536 additions and 10 deletions
+14
View File
@@ -0,0 +1,14 @@
from io import BytesIO
from django.http import HttpResponse
from django.template.loader import get_template
from xhtml2pdf import pisa
def render_to_pdf(template, context):
html = get_template(template).render(context)
result = BytesIO()
pdf = pisa.pisaDocument(BytesIO(html.encode("ISO-8859-1")), result)
if pdf.err:
return HttpResponse("Invalid PDF", status_code=400, content_type='text/plan')
return HttpResponse(result.getvalue(), content_type='application/pdf')