1👍
✅
Not the most satisfactory of work rounds, but I found that if I have the download open in a new tab by adding target=”_blank” to my link, it then downloads without a problem.
1👍
Looks like you have a typo in content_type, it should be:
content_type = 'application/force-download'
Also, last line is missing %:
response['Content-Disposition'] = 'attachment; filename="%s"' % file_name
- [Answered ]-Python Django query error: Can't convert 'method' object to str implicitly
- [Answered ]-Django custom 404 not found page
- [Answered ]-Display uploaded files in Django
Source:stackexchange.com