2👍
✅
Thanks to Sayse the trick was to specify the mimetypes in the content_type header
import mymetypes
response = HttpResponse(content_type=mimetypes.guess_type(file_name))
response.write(docfile)
response['Content-Disposition'] = 'attachment; filename={0}'.format(file_name)
return response
Source:stackexchange.com