Get the content as if it had been rendered by the default non-documenting renderer.
(self, renderer, data,
accepted_media_type, renderer_context)
| 424 | return renderers[0]() |
| 425 | |
| 426 | def get_content(self, renderer, data, |
| 427 | accepted_media_type, renderer_context): |
| 428 | """ |
| 429 | Get the content as if it had been rendered by the default |
| 430 | non-documenting renderer. |
| 431 | """ |
| 432 | if not renderer: |
| 433 | return '[No renderers were found]' |
| 434 | |
| 435 | renderer_context['indent'] = 4 |
| 436 | content = renderer.render(data, accepted_media_type, renderer_context) |
| 437 | |
| 438 | render_style = getattr(renderer, 'render_style', 'text') |
| 439 | assert render_style in ['text', 'binary'], 'Expected .render_style ' \ |
| 440 | '"text" or "binary", but got "%s"' % render_style |
| 441 | if render_style == 'binary': |
| 442 | return '[%d bytes of binary content]' % len(content) |
| 443 | |
| 444 | return content.decode('utf-8') if isinstance(content, bytes) else content |
| 445 | |
| 446 | def show_form_for_method(self, view, method, request, obj): |
| 447 | """ |