I wonder if someone can point out my mistake?
The following code happily downloads a constructed text file ...
csv = make_csv(context['result'])
# This downloads a csv file to the user desktop
return HttpResponse(
csv,
headers={
'Content-Type': 'text/plain',
# Set the content-disposition header to prompt user download
'Content-Disposition': f'attachment; filename="{fname}.csv"'
},
)
... but leaves all the entered (unbound) form data on display.
However, I want the form cleared ready for the next set of user
data.
The following code clears the entered data but fails to download the
constructed file.
csv = make_csv(context['result'])
# This fails to download a csv file
return HttpResponseRedirect(
"",
csv,
headers={
'Content-Type': 'text/plain',
# Set the content-disposition header to prompt user download
'Content-Disposition': f'attachment; filename="{fname}.csv"'
},
)
Many thanks for any help
Cheers
Mike
--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.