diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt
index bcc6f38..1f9efb5 100644
|
a
|
b
|
Here's an example::
|
| 20 | 20 | |
| 21 | 21 | def some_view(request): |
| 22 | 22 | # Create the HttpResponse object with the appropriate CSV header. |
| 23 | | response = HttpResponse(mimetype='text/csv') |
| | 23 | response = HttpResponse(content_type='text/csv') |
| 24 | 24 | response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' |
| 25 | 25 | |
| 26 | 26 | writer = csv.writer(response) |
| … |
… |
Here's an example, which generates the same CSV file as above::
|
| 92 | 92 | |
| 93 | 93 | def some_view(request): |
| 94 | 94 | # Create the HttpResponse object with the appropriate CSV header. |
| 95 | | response = HttpResponse(mimetype='text/csv') |
| | 95 | response = HttpResponse(content_type='text/csv') |
| 96 | 96 | response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' |
| 97 | 97 | |
| 98 | 98 | # The data is hard-coded here, but you could load it from a database or |
| … |
… |
Here's an example, which generates the same CSV file as above::
|
| 111 | 111 | |
| 112 | 112 | The only difference between this example and the previous example is that this |
| 113 | 113 | one uses template loading instead of the CSV module. The rest of the code -- |
| 114 | | such as the ``mimetype='text/csv'`` -- is the same. |
| | 114 | such as the ``content_type='text/csv'`` -- is the same. |
| 115 | 115 | |
| 116 | 116 | Then, create the template ``my_template_name.txt``, with this template code: |
| 117 | 117 | |
diff --git a/docs/howto/outputting-pdf.txt b/docs/howto/outputting-pdf.txt
index 9d87b97..d15f94f 100644
|
a
|
b
|
Here's a "Hello World" example::
|
| 51 | 51 | |
| 52 | 52 | def some_view(request): |
| 53 | 53 | # Create the HttpResponse object with the appropriate PDF headers. |
| 54 | | response = HttpResponse(mimetype='application/pdf') |
| | 54 | response = HttpResponse(content_type='application/pdf') |
| 55 | 55 | response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"' |
| 56 | 56 | |
| 57 | 57 | # Create the PDF object, using the response object as its "file." |
| … |
… |
Here's the above "Hello World" example rewritten to use :mod:`io`::
|
| 120 | 120 | |
| 121 | 121 | def some_view(request): |
| 122 | 122 | # Create the HttpResponse object with the appropriate PDF headers. |
| 123 | | response = HttpResponse(mimetype='application/pdf') |
| | 123 | response = HttpResponse(content_type='application/pdf') |
| 124 | 124 | response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"' |
| 125 | 125 | |
| 126 | 126 | buffer = BytesIO() |
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index 63d65d1..ee408ba 100644
|
a
|
b
|
these changes.
|
| 290 | 290 | specified as a plain string instead of a tuple will be removed and raise an |
| 291 | 291 | exception. |
| 292 | 292 | |
| 293 | | * The ``mimetype`` argument to :class:`~django.http.HttpResponse` ``__init__`` |
| 294 | | will be removed (``content_type`` should be used instead). |
| | 293 | * The ``mimetype`` argument to the ``__init__`` methods of |
| | 294 | :class:`~django.http.HttpResponse`, |
| | 295 | :class:`~django.template.response.SimpleTemplateResponse`, and |
| | 296 | :class:`~django.template.response.TemplateResponse` will be removed |
| | 297 | (``content_type`` should be used instead). |
| 295 | 298 | |
| 296 | 299 | * When :class:`~django.http.HttpResponse` is instantiated with an iterator, |
| 297 | 300 | or when :attr:`~django.http.HttpResponse.content` is set to an iterator, |
diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt
index d7eef62..223f2ff 100644
|
a
|
b
|
objects as JSON::
|
| 223 | 223 | from django.core import serializers |
| 224 | 224 | |
| 225 | 225 | def export_as_json(modeladmin, request, queryset): |
| 226 | | response = HttpResponse(mimetype="text/javascript") |
| | 226 | response = HttpResponse(content_type="text/javascript") |
| 227 | 227 | serializers.serialize("json", queryset, stream=response) |
| 228 | 228 | return response |
| 229 | 229 | |
| … |
… |
Conditionally enabling or disabling actions
|
| 356 | 356 | if 'delete_selected' in actions: |
| 357 | 357 | del actions['delete_selected'] |
| 358 | 358 | return actions |
| 359 | | |
| 360 | | |
diff --git a/docs/ref/template-response.txt b/docs/ref/template-response.txt
index 3f5e772..7b8dff5 100644
|
a
|
b
|
Attributes
|
| 56 | 56 | Methods |
| 57 | 57 | ------- |
| 58 | 58 | |
| 59 | | .. method:: SimpleTemplateResponse.__init__(template, context=None, mimetype=None, status=None, content_type=None) |
| | 59 | .. method:: SimpleTemplateResponse.__init__(template, context=None, status=None, content_type=None) |
| 60 | 60 | |
| 61 | 61 | Instantiates a |
| 62 | 62 | :class:`~django.template.response.SimpleTemplateResponse` object |
| 63 | | with the given template, context, MIME type and HTTP status. |
| | 63 | with the given template, context, content type, and HTTP status. |
| 64 | 64 | |
| 65 | 65 | ``template`` |
| 66 | 66 | The full name of a template, or a sequence of template names. |
| … |
… |
Methods
|
| 75 | 75 | The HTTP Status code for the response. |
| 76 | 76 | |
| 77 | 77 | ``content_type`` |
| 78 | | An alias for ``mimetype``. Historically, this parameter was only called |
| 79 | | ``mimetype``, but since this is actually the value included in the HTTP |
| 80 | | ``Content-Type`` header, it can also include the character set encoding, |
| 81 | | which makes it more than just a MIME type specification. If ``mimetype`` |
| 82 | | is specified (not ``None``), that value is used. Otherwise, |
| 83 | | ``content_type`` is used. If neither is given, |
| | 78 | Historically, this parameter was only called ``mimetype`` (now |
| | 79 | deprecated), but since this is actually the value included in the HTTP |
| | 80 | ``Content-Type`` header, it can also include the character set |
| | 81 | encoding, which makes it more than just a MIME type specification. If |
| | 82 | ``mimetype`` is specified (not ``None``), that value is used. |
| | 83 | Otherwise, ``content_type`` is used. If neither is given, |
| 84 | 84 | :setting:`DEFAULT_CONTENT_TYPE` is used. |
| 85 | 85 | |
| 86 | 86 | |
| … |
… |
TemplateResponse objects
|
| 144 | 144 | Methods |
| 145 | 145 | ------- |
| 146 | 146 | |
| 147 | | .. method:: TemplateResponse.__init__(request, template, context=None, mimetype=None, status=None, content_type=None, current_app=None) |
| | 147 | .. method:: TemplateResponse.__init__(request, template, context=None, status=None, content_type=None, current_app=None) |
| 148 | 148 | |
| 149 | 149 | Instantiates an ``TemplateResponse`` object with the given |
| 150 | 150 | template, context, MIME type and HTTP status. |
| … |
… |
Methods
|
| 165 | 165 | The HTTP Status code for the response. |
| 166 | 166 | |
| 167 | 167 | ``content_type`` |
| 168 | | An alias for ``mimetype``. Historically, this parameter was only called |
| 169 | | ``mimetype``, but since this is actually the value included in the HTTP |
| 170 | | ``Content-Type`` header, it can also include the character set encoding, |
| 171 | | which makes it more than just a MIME type specification. If ``mimetype`` |
| 172 | | is specified (not ``None``), that value is used. Otherwise, |
| 173 | | ``content_type`` is used. If neither is given, |
| | 168 | Historically, this parameter was only called ``mimetype`` (now |
| | 169 | deprecated), but since this is actually the value included in the HTTP |
| | 170 | ``Content-Type`` header, it can also include the character set |
| | 171 | encoding, which makes it more than just a MIME type specification. If |
| | 172 | ``mimetype`` is specified (not ``None``), that value is used. |
| | 173 | Otherwise, ``content_type`` is used. If neither is given, |
| 174 | 174 | :setting:`DEFAULT_CONTENT_TYPE` is used. |
| 175 | 175 | |
| 176 | 176 | ``current_app`` |
diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt
index b1b4700..1a82723 100644
|
a
|
b
|
This example is equivalent to::
|
| 148 | 148 | t = loader.get_template('myapp/template.html') |
| 149 | 149 | c = Context({'foo': 'bar'}) |
| 150 | 150 | return HttpResponse(t.render(c), |
| 151 | | mimetype="application/xhtml+xml") |
| | 151 | content_type="application/xhtml+xml") |
| 152 | 152 | |
| 153 | 153 | ``redirect`` |
| 154 | 154 | ============ |