From bbedc5c896800de4b23b5042e10b61a0e85222db Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sun, 1 Oct 2017 11:20:23 +0200 Subject: [PATCH 1/2] reused 'apply_markdown' function in 'render_markdown' templatetag function --- rest_framework/templatetags/rest_framework.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index a2ee5ccddf..e401b9ff3d 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -11,7 +11,8 @@ from django.utils.safestring import SafeData, mark_safe from rest_framework.compat import ( - NoReverseMatch, markdown, pygments_highlight, reverse, template_render + NoReverseMatch, apply_markdown, pygments_highlight, reverse, + template_render, ) from rest_framework.renderers import HTMLFormRenderer from rest_framework.utils.urls import replace_query_param @@ -68,9 +69,9 @@ def form_for_link(link): @register.simple_tag def render_markdown(markdown_text): - if not markdown: + if apply_markdown is None: return markdown_text - return mark_safe(markdown.markdown(markdown_text)) + return mark_safe(apply_markdown(markdown_text)) @register.simple_tag From 64a876d0d0062800d79af4bd02ccabe61e48317a Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sun, 1 Oct 2017 11:40:50 +0200 Subject: [PATCH 2/2] typo fixed --- rest_framework/templatetags/rest_framework.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index e401b9ff3d..264b6444cf 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -12,7 +12,7 @@ from rest_framework.compat import ( NoReverseMatch, apply_markdown, pygments_highlight, reverse, - template_render, + template_render ) from rest_framework.renderers import HTMLFormRenderer from rest_framework.utils.urls import replace_query_param