diff options
| author | Tom Christie | 2013-06-28 09:07:09 +0100 |
|---|---|---|
| committer | Tom Christie | 2013-06-28 09:07:09 +0100 |
| commit | 58d38d694eba94d4c6c20edcbefb5f4f91e6dd0f (patch) | |
| tree | ba72bed1f1f20bed9d023fb076e0adcf7e92abf1 /docs/api-guide/responses.md | |
| parent | de00ec95c3007dd90b5b01f7486b430699ea63c1 (diff) | |
| parent | 1f6a59d76da286e7a89e8e41317beb16a4aab7c7 (diff) | |
| download | django-rest-framework-58d38d694eba94d4c6c20edcbefb5f4f91e6dd0f.tar.bz2 | |
Merge branch 'master' into writable-nested-modelserializer
Diffstat (limited to 'docs/api-guide/responses.md')
| -rw-r--r-- | docs/api-guide/responses.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/api-guide/responses.md b/docs/api-guide/responses.md index 374276dc..399b7c23 100644 --- a/docs/api-guide/responses.md +++ b/docs/api-guide/responses.md @@ -8,9 +8,9 @@ REST framework supports HTTP content negotiation by providing a `Response` class which allows you to return content that can be rendered into multiple content types, depending on the client request. -The `Response` class subclasses Django's `SimpleTemplateResponse`. `Response` objects are initialised with data, which should consist of native python primatives. REST framework then uses standard HTTP content negotiation to determine how it should render the final response content. +The `Response` class subclasses Django's `SimpleTemplateResponse`. `Response` objects are initialised with data, which should consist of native Python primitives. REST framework then uses standard HTTP content negotiation to determine how it should render the final response content. -There's no requirement for you to use the `Response` class, you can also return regular `HttpResponse` objects from your views if you want, but it provides a nicer interface for returning Web API responses. +There's no requirement for you to use the `Response` class, you can also return regular `HttpResponse` or `StreamingHttpResponse` objects from your views if required. Using the `Response` class simply provides a nicer interface for returning content-negotiated Web API responses, that can be rendered to multiple formats. Unless you want to heavily customize REST framework for some reason, you should always use an `APIView` class or `@api_view` function for views that return `Response` objects. Doing so ensures that the view can perform content negotiation and select the appropriate renderer for the response, before it is returned from the view. @@ -22,7 +22,7 @@ Unless you want to heavily customize REST framework for some reason, you should **Signature:** `Response(data, status=None, template_name=None, headers=None, content_type=None)` -Unlike regular `HttpResponse` objects, you do not instantiate `Response` objects with rendered content. Instead you pass in unrendered data, which may consist of any python primatives. +Unlike regular `HttpResponse` objects, you do not instantiate `Response` objects with rendered content. Instead you pass in unrendered data, which may consist of any Python primitives. The renderers used by the `Response` class cannot natively handle complex datatypes such as Django model instances, so you need to serialize the data into primative datatypes before creating the `Response` object. |
