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
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
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
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/
4 matches
Mail list logo