diff options
Diffstat (limited to 'docs/howto')
| -rw-r--r-- | docs/howto/outputting-csv.txt | 6 | ||||
| -rw-r--r-- | docs/howto/outputting-pdf.txt | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt index bcc6f3827b..1f9efb5a4b 100644 --- a/docs/howto/outputting-csv.txt +++ b/docs/howto/outputting-csv.txt @@ -20,7 +20,7 @@ Here's an example:: def some_view(request): # Create the HttpResponse object with the appropriate CSV header. - response = HttpResponse(mimetype='text/csv') + response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' writer = csv.writer(response) @@ -92,7 +92,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(mimetype='text/csv') + response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' # The data is hard-coded here, but you could load it from a database or @@ -111,7 +111,7 @@ Here's an example, which generates the same CSV file as above:: The only difference between this example and the previous example is that this one uses template loading instead of the CSV module. The rest of the code -- -such as the ``mimetype='text/csv'`` -- is the same. +such as the ``content_type='text/csv'`` -- is the same. Then, create the template ``my_template_name.txt``, with this template code: diff --git a/docs/howto/outputting-pdf.txt b/docs/howto/outputting-pdf.txt index 9d87b97710..d15f94f7f4 100644 --- a/docs/howto/outputting-pdf.txt +++ b/docs/howto/outputting-pdf.txt @@ -51,7 +51,7 @@ Here's a "Hello World" example:: def some_view(request): # Create the HttpResponse object with the appropriate PDF headers. - response = HttpResponse(mimetype='application/pdf') + response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"' # Create the PDF object, using the response object as its "file." @@ -120,7 +120,7 @@ Here's the above "Hello World" example rewritten to use :mod:`io`:: def some_view(request): # Create the HttpResponse object with the appropriate PDF headers. - response = HttpResponse(mimetype='application/pdf') + response = HttpResponse(content_type='application/pdf') response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"' buffer = BytesIO() |
