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. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3b59be97-0cf9-4654-97ac-86da72ed4737%40dewhirst.com.au.
OpenPGP_signature.asc
Description: OpenPGP digital signature