mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
Docs for HTMLFormRenderer
This commit is contained in:
parent
be0f5850c3
commit
c7847ebc45
|
@ -212,6 +212,18 @@ You can use `TemplateHTMLRenderer` either to return regular HTML pages using RES
|
|||
|
||||
See also: `TemplateHTMLRenderer`
|
||||
|
||||
## HTMLFormRenderer
|
||||
|
||||
Renders data returned by a serializer into an HTML form. The output of this renderer does not include the enclosing `<form>` tags or an submit actions, as you'll probably need those to include the desired method and URL. Also note that the `HTMLFormRenderer` does not yet support including field error messages.
|
||||
|
||||
**.media_type**: `text/html`
|
||||
|
||||
**.format**: `'.form'`
|
||||
|
||||
**.charset**: `utf-8`
|
||||
|
||||
**.template**: `'rest_framework/form.html'`
|
||||
|
||||
## BrowsableAPIRenderer
|
||||
|
||||
Renders data into HTML for the Browsable API. This renderer will determine which other renderer would have been given highest priority, and use that to display an API style response within the HTML page.
|
||||
|
@ -222,6 +234,8 @@ Renders data into HTML for the Browsable API. This renderer will determine whic
|
|||
|
||||
**.charset**: `utf-8`
|
||||
|
||||
**.template**: `'rest_framework/api.html'`
|
||||
|
||||
#### 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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user