MCPcopy Index your code
hub / github.com/encode/django-rest-framework / render

Method render

rest_framework/renderers.py:742–760  ·  view source on GitHub ↗

Render the HTML for the browsable API representation.

(self, data, accepted_media_type=None, renderer_context=None)

Source from the content-addressed store, hash-verified

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
763class AdminRenderer(BrowsableAPIRenderer):

Callers

nothing calls this directly

Calls 3

get_contextMethod · 0.95
get_templateMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected