Clarify documentation for TemplateHTMLRenderer

Clarify that the response from a view may need to be modified to provide TemplateHTMLRenderer with a dict for it to use.
This commit is contained in:
Adrian Coveney 2018-07-25 10:53:43 +01:00 committed by Xavier Ordoquy
parent 8351747d98
commit 3db8877889

View File

@ -103,6 +103,16 @@ Unlike other renderers, the data passed to the `Response` does not need to be se
The TemplateHTMLRenderer will create a `RequestContext`, using the `response.data` as the context dict, and determine a template name to use to render the context.
---
**Note:** When used with a view that makes use of a serializer the `Response` sent for rendering may not be a dictionay and will need to be wrapped in a dict before returning to allow the TemplateHTMLRenderer to render it. For example:
```
response.data = {'results': response.data}
```
---
The template name is determined by (in order of preference):
1. An explicit `template_name` argument passed to the response.