mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-06-20 21:43:22 +03:00
docs/renderers: StaticHTMLRenderer
instead of TemplateHTMLRenderer
The `StaticHTMLRenderer` section referred to `TemplateHTMLRenderer` instead of `StaticHTMLRenderer`.
This commit is contained in:
parent
ec5c3aa5e7
commit
0f5082d9b8
|
@ -135,7 +135,7 @@ See also: `StaticHTMLRenderer`
|
||||||
|
|
||||||
A simple renderer that simply returns pre-rendered HTML. Unlike other renderers, the data passed to the response object should be a string representing the content to be returned.
|
A simple renderer that simply returns pre-rendered HTML. Unlike other renderers, the data passed to the response object should be a string representing the content to be returned.
|
||||||
|
|
||||||
An example of a view that uses `TemplateHTMLRenderer`:
|
An example of a view that uses `StaticHTMLRenderer`:
|
||||||
|
|
||||||
@api_view(('GET',))
|
@api_view(('GET',))
|
||||||
@renderer_classes((StaticHTMLRenderer,))
|
@renderer_classes((StaticHTMLRenderer,))
|
||||||
|
@ -143,7 +143,7 @@ An example of a view that uses `TemplateHTMLRenderer`:
|
||||||
data = '<html><body><h1>Hello, world</h1></body></html>'
|
data = '<html><body><h1>Hello, world</h1></body></html>'
|
||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
||||||
You can use `TemplateHTMLRenderer` either to return regular HTML pages using REST framework, or to return both HTML and API responses from a single endpoint.
|
You can use `StaticHTMLRenderer` either to return regular HTML pages using REST framework, or to return both HTML and API responses from a single endpoint.
|
||||||
|
|
||||||
**.media_type**: `text/html`
|
**.media_type**: `text/html`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user