2022-06-24 17:14:37 +02:00

9 lines
293 B
Python

from django.http import HttpResponse
class PDFResponse(HttpResponse):
def __init__(self, content, filename=None):
super(PDFResponse, self).__init__(content_type="application/pdf")
self["Content-Disposition"] = 'filename="{}"'.format(filename)
self.write(content)