When user click download button I want to generate multiple pdf Currently I can only generate one PDF
What I want is to generate two PDF from Django view when user click download button with weasyprint.
Below code only generate single PDF
def get(self, *args, **kwargs):
obj = self.get_object()
html_result = super(GenerateInvoicePDFView, self).get(*args,
**kwargs)
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename="%s.pdf"' %
obj.name
weasyprint.HTML(string= html_result.getvalue()).write_pdf(response)
return response
This response should generate two PDF, is it possible ? Please help Thanks
You cannot return multiple files in the response. Only solution I see is zipping them, sending them to user by email, or creating two separate download buttons.
How about:
view:
template: