Skip to content

Commit

Permalink
Notes on customizing BrowsableAPIRenderer. Refs encode#1001
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchristie committed Jul 29, 2013
1 parent 6a6b2c9 commit 856dc85
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/api-guide/renderers.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ 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].
Expand Down

0 comments on commit 856dc85

Please sign in to comment.