diff options
| author | Philip Douglas | 2013-07-31 07:45:05 -0700 |
|---|---|---|
| committer | Philip Douglas | 2013-07-31 07:45:05 -0700 |
| commit | c058ab36b13a6979c57760d9af2eb21ec3165e7d (patch) | |
| tree | 9c352f0ebaddf18b03e45de9bf4ee3ad53377e17 /docs/api-guide/renderers.md | |
| parent | bf8e71c455a47a53898f8239ac7dad47e5f1d53a (diff) | |
| parent | 43a5f8183c90f1056bbf33bb1402e76883aeb1fd (diff) | |
| download | django-rest-framework-c058ab36b13a6979c57760d9af2eb21ec3165e7d.tar.bz2 | |
Merge pull request #2 from tomchristie/master
Update to latest
Diffstat (limited to 'docs/api-guide/renderers.md')
| -rw-r--r-- | docs/api-guide/renderers.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md index b627c930..b434efe9 100644 --- a/docs/api-guide/renderers.md +++ b/docs/api-guide/renderers.md @@ -217,6 +217,24 @@ Renders data into HTML for the Browsable API. This renderer will determine whic **.charset**: `utf-8` +#### Customizing BrowsableAPIRenderer + +By default the response content will be rendered with the highest priority renderer apart from `BrowseableAPIRenderer`. If you need to customize this behavior, for example to use HTML as the default return format, but use JSON in the browsable API, you can do so by overriding the `get_default_renderer()` method. For example: + + class CustomBrowsableAPIRenderer(BrowsableAPIRenderer): + def get_default_renderer(self, view): + return JSONRenderer() + +## MultiPartRenderer + +This renderer is used for rendering HTML multipart form data. **It is not suitable as a response renderer**, but is instead used for creating test requests, using REST framework's [test client and test request factory][testing]. + +**.media_type**: `multipart/form-data; boundary=BoUnDaRyStRiNg` + +**.format**: `'.multipart'` + +**.charset**: `utf-8` + --- # Custom renderers @@ -373,6 +391,7 @@ Comma-separated values are a plain-text tabular data format, that can be easily [rfc4627]: http://www.ietf.org/rfc/rfc4627.txt [cors]: http://www.w3.org/TR/cors/ [cors-docs]: ../topics/ajax-csrf-cors.md +[testing]: testing.md [HATEOAS]: http://timelessrepo.com/haters-gonna-hateoas [quote]: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven [application/vnd.github+json]: http://developer.github.com/v3/media/ |
