我有一种情况,我不知道如何用Django解决。用户正在处理表单,然后一旦表单完成,用户便可以从表单中的数据生成PDF。我想将用户重定向到另一个页面,因为一旦生成了文档,就无需在表单页面中说了。
views.py
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = "attachment; filename=" + filename +'.pdf'
response.write(pdf)
return response