diff options
Diffstat (limited to 'docs/howto')
| -rw-r--r-- | docs/howto/outputting-csv.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt index 2886a1b294..dc3cf57cfd 100644 --- a/docs/howto/outputting-csv.txt +++ b/docs/howto/outputting-csv.txt @@ -21,7 +21,7 @@ Here's an example:: def some_view(request): # Create the HttpResponse object with the appropriate CSV header. response = HttpResponse(content_type='text/csv') - response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' + response.headers['Content-Disposition'] = 'attachment; filename="somefilename.csv"' writer = csv.writer(response) writer.writerow(['First row', 'Foo', 'Bar', 'Baz']) @@ -88,7 +88,7 @@ the assembly and transmission of a large CSV file:: writer = csv.writer(pseudo_buffer) response = StreamingHttpResponse((writer.writerow(row) for row in rows), content_type="text/csv") - response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' + response.headers['Content-Disposition'] = 'attachment; filename="somefilename.csv"' return response Using the template system @@ -109,7 +109,7 @@ Here's an example, which generates the same CSV file as above:: def some_view(request): # Create the HttpResponse object with the appropriate CSV header. response = HttpResponse(content_type='text/csv') - response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' + response.headers['Content-Disposition'] = 'attachment; filename="somefilename.csv"' # The data is hard-coded here, but you could load it from a database or # some other source. |
