aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/renderers.md
diff options
context:
space:
mode:
authorTom Christie2013-08-23 16:46:14 +0100
committerTom Christie2013-08-23 16:46:14 +0100
commitc77e4a2c591436dd9433f1bd4e3c6349d8f4b835 (patch)
treee53387e123b093e5795080fb92f04df5e5b89f68 /docs/api-guide/renderers.md
parente23d5888522f98c30418452c0f833cf11589e0c1 (diff)
parent436e66a42db21b52fd5e1582011d2f0f7f81f9c7 (diff)
downloaddjango-rest-framework-c77e4a2c591436dd9433f1bd4e3c6349d8f4b835.tar.bz2
Merge branch 'master' into html-form-renderer
Diffstat (limited to 'docs/api-guide/renderers.md')
-rw-r--r--docs/api-guide/renderers.md9
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md
index 7fc1fc1f..d46d0568 100644
--- a/docs/api-guide/renderers.md
+++ b/docs/api-guide/renderers.md
@@ -88,7 +88,7 @@ The client may additionally include an `'indent'` media type parameter, in which
**.format**: `'.json'`
-**.charset**: `utf-8`
+**.charset**: `None`
## UnicodeJSONRenderer
@@ -110,7 +110,7 @@ Both the `JSONRenderer` and `UnicodeJSONRenderer` styles conform to [RFC 4627][r
**.format**: `'.json'`
-**.charset**: `utf-8`
+**.charset**: `None`
## JSONPRenderer
@@ -295,12 +295,15 @@ By default renderer classes are assumed to be using the `UTF-8` encoding. To us
Note that if a renderer class returns a unicode string, then the response content will be coerced into a bytestring by the `Response` class, with the `charset` attribute set on the renderer used to determine the encoding.
-If the renderer returns a bytestring representing raw binary content, you should set a charset value of `None`, which will ensure the `Content-Type` header of the response will not have a `charset` value set. Doing so will also ensure that the browsable API will not attempt to display the binary content as a string.
+If the renderer returns a bytestring representing raw binary content, you should set a charset value of `None`, which will ensure the `Content-Type` header of the response will not have a `charset` value set.
+
+In some cases you may also want to set the `render_style` attribute to `'binary'`. Doing so will also ensure that the browsable API will not attempt to display the binary content as a string.
class JPEGRenderer(renderers.BaseRenderer):
media_type = 'image/jpeg'
format = 'jpg'
charset = None
+ render_style = 'binary'
def render(self, data, media_type=None, renderer_context=None):
return data