下载文件简写法

root
abc abc
  • 8 Oct

response = HttpResponse(
... my_data,
... headers={
... "Content-Type": "application/vnd.ms-excel",
... "Content-Disposition": 'attachment; filename="foo.xls"',
... },
... )
Content-Disposition 头并没有什么 Django 特有的内容,但是很容易忘记语法,所以我们把它包含