Re: HttpResponse works but HttpResponseRedirect does not

2024-01-02 Thread Mike Dewhirst
it is doing.CheersMike--(Unsigned mail from my phone) Original message From: Alex007 MULUMBA Date: 3/1/24 08:38 (GMT+10:00) To: django-users@googlegroups.com Subject: Re: HttpResponse works but HttpResponseRedirect does not import pandas as pd from django.http import HttpResponse # Ass

Re: HttpResponse works but HttpResponseRedirect does not

2024-01-02 Thread Alex007 MULUMBA
import pandas as pd from django.http import HttpResponse # Assuming Django context data_frame = pd.DataFrame.from_records(data) data_frame.to_csv( "output.csv", index=False) # Save as CSV with open("output.csv", 'rb') as f: response = HttpResponse(f.read(), content_type='text/csv') response[ 'Conte

Re: HttpResponse works but HttpResponseRedirect does not

2024-01-02 Thread OSP PRO
One potential issue in the code is that the variable fname is being used in the Content-Disposition header, but it's not defined in the provided snippet. Make sure that fname is defined and contains the desired filename for the CSV file. Additionally, it's important to ensure that the make_csv fun

HttpResponse works but HttpResponseRedirect does not

2024-01-01 Thread Mike Dewhirst
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/