You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guide/renderers.md
+36-14Lines changed: 36 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -153,23 +153,13 @@ You can use `StaticHTMLRenderer` either to return regular HTML pages using REST
153
153
154
154
See also: `TemplateHTMLRenderer`
155
155
156
-
## HTMLFormRenderer
157
-
158
-
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.
159
-
160
-
**Note**: The `HTMLFormRenderer` class is intended for internal use with the browsable API. It should not be considered a fully documented or stable API. The template used by the `HTMLFormRenderer` class, and the context submitted to it **may be subject to change**. If you need to use this renderer class it is advised that you either make a local copy of the class and templates, or follow the release note on REST framework upgrades closely.
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.
162
+
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.
173
163
174
164
**.media_type**: `text/html`
175
165
@@ -187,6 +177,38 @@ By default the response content will be rendered with the highest priority rende
187
177
def get_default_renderer(self, view):
188
178
return JSONRenderer()
189
179
180
+
## AdminRenderer
181
+
182
+
Renders data into HTML for an admin-like display:
183
+
184
+

185
+
186
+
This renderer is suitable for CRUD-style web APIs that should also present a user-friendly interface for managing the data.
187
+
188
+
Note that views that have nested or list serializers for their input won't work well with the `AdminRenderer`, as the HTML forms are unable to properly support them.
189
+
190
+
**.media_type**: `text/html`
191
+
192
+
**.format**: `'.admin'`
193
+
194
+
**.charset**: `utf-8`
195
+
196
+
**.template**: `'rest_framework/admin.html'`
197
+
198
+
## HTMLFormRenderer
199
+
200
+
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.
201
+
202
+
**Note**: The `HTMLFormRenderer` class is intended for internal use with the browsable API and admin interface. It should not be considered a fully documented or stable API. The template used by the `HTMLFormRenderer` class, and the context submitted to it **may be subject to change**. If you need to use this renderer class it is advised that you either make a local copy of the class and templates, or follow the release note on REST framework upgrades closely.
203
+
204
+
**.media_type**: `text/html`
205
+
206
+
**.format**: `'.form'`
207
+
208
+
**.charset**: `utf-8`
209
+
210
+
**.template**: `'rest_framework/form.html'`
211
+
190
212
## MultiPartRenderer
191
213
192
214
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].
0 commit comments