Render the HTML for the browsable API representation.
(self, data, accepted_media_type=None, renderer_context=None)
| 740 | } |
| 741 | |
| 742 | def render(self, data, accepted_media_type=None, renderer_context=None): |
| 743 | """ |
| 744 | Render the HTML for the browsable API representation. |
| 745 | """ |
| 746 | self.accepted_media_type = accepted_media_type or '' |
| 747 | self.renderer_context = renderer_context or {} |
| 748 | |
| 749 | template = loader.get_template(self.template) |
| 750 | context = self.get_context(data, accepted_media_type, renderer_context) |
| 751 | ret = template.render(context, request=renderer_context['request']) |
| 752 | |
| 753 | # Munge DELETE Response code to allow us to return content |
| 754 | # (Do this *after* we've rendered the template so that we include |
| 755 | # the normal deletion response code in the output) |
| 756 | response = renderer_context['response'] |
| 757 | if response.status_code == status.HTTP_204_NO_CONTENT: |
| 758 | response.status_code = status.HTTP_200_OK |
| 759 | |
| 760 | return ret |
| 761 | |
| 762 | |
| 763 | class AdminRenderer(BrowsableAPIRenderer): |
nothing calls this directly
no test coverage detected