diff --git a/djangorestframework/renderers.py b/djangorestframework/renderers.py index 42d80bd4d..823743985 100644 --- a/djangorestframework/renderers.py +++ b/djangorestframework/renderers.py @@ -322,12 +322,21 @@ class DocumentingTemplateRenderer(BaseRenderer): name = get_name(self.view) description = get_description(self.view) - markeddown = None + markeddown = {} if apply_markdown: try: - markeddown = apply_markdown(description) + markeddown['view'] = apply_markdown(description) except AttributeError: - markeddown = None + markeddown.pop('view', None) + for method in self.view.allowed_methods: + methodfunc = getattr(self.view, method.lower(), None) + if methodfunc is None: + continue + methoddesc = get_description(methodfunc) + try: + markeddown[method] = apply_markdown(methoddesc) + except AttributeError: + markeddown.pop(method, None) breadcrumb_list = get_breadcrumbs(self.view.request.path) diff --git a/djangorestframework/templates/renderer.html b/djangorestframework/templates/renderer.html index 132bdb818..94ea3f966 100644 --- a/djangorestframework/templates/renderer.html +++ b/djangorestframework/templates/renderer.html @@ -45,7 +45,7 @@
{% if markeddown %}{% autoescape off %}{{ markeddown }}{% endautoescape %}{% else %}{{ description|linebreaksbr }}{% endif %}
{% if markeddown.view %}{% autoescape off %}{{ markeddown.view }}{% endautoescape %}{% else %}{{ description|linebreaksbr }}{% endif %}
{{ response.status }} {{ response.status_text }}{% autoescape off %} {% for key, val in response.headers.items %}{{ key }}: {{ val|urlize_quoted_links }} @@ -56,6 +56,7 @@
{% autoescape off %}{{ markeddown.GET }}{% endautoescape %}
{% autoescape off %}{{ markeddown.POST }}{% endautoescape %}
{% autoescape off %}{{ markeddown.PUT }}{% endautoescape %}
{% autoescape off %}{{ markeddown.DELETE }}{% endautoescape %}