Swappable invoice renderers

This commit is contained in:
Raphael Michel
2017-07-07 11:16:07 +02:00
parent 95e716b8ce
commit 6e65ae5306
12 changed files with 564 additions and 279 deletions

View File

@@ -310,9 +310,9 @@ class InvoicePreview(EventPermissionRequiredMixin, View):
permission = 'can_change_event_settings'
def get(self, request, *args, **kwargs):
pdf = build_preview_invoice_pdf(request.event)
resp = HttpResponse(pdf, content_type='application/pdf')
resp['Content-Disposition'] = 'attachment; filename="invoice-preview.pdf"'
fname, ftype, fcontent = build_preview_invoice_pdf(request.event)
resp = HttpResponse(fcontent, content_type=ftype)
resp['Content-Disposition'] = 'attachment; filename="{}"'.format(fname)
return resp