I am trying to return a file download directly from a view, which works fine on Mac OS, except when I run this from a Windows OS (from the browser), the file does not have the 3 lines, but just 1.. Is there a solution for this, I have read a lot of articles about cross os issues, but none seem to have a solution covered
template (pseudo code, notice 3 lines, on windows this is downloaded as a single line)
%DO% script/{foo}.sh --var={bar}
%END%
some,comma,separated,stuff
view
def view(self, request, **kwargs):
file_name = 'test.txt'
template = render_to_string('templates/test.txt', { # <= template
"foo": "hello",
"bar": "world"
})
resp = HttpResponse(template, content_type='application/force-download')
resp['Content-Disposition'] = 'attachment; filename=%s' % smart_str(file_name)
return resp