diff --git a/docs/tutorial/6-viewsets-and-routers.md b/docs/tutorial/6-viewsets-and-routers.md index 6189c7771..252021e39 100644 --- a/docs/tutorial/6-viewsets-and-routers.md +++ b/docs/tutorial/6-viewsets-and-routers.md @@ -26,6 +26,7 @@ Here we've used the `ReadOnlyModelViewSet` class to automatically provide the de Next we're going to replace the `SnippetList`, `SnippetDetail` and `SnippetHighlight` view classes. We can remove the three views, and again replace them with a single class. from rest_framework.decorators import detail_route + from rest_framework.response import Response class SnippetViewSet(viewsets.ModelViewSet): """ diff --git a/rest_framework/templates/rest_framework/filters/django_filter.html b/rest_framework/templates/rest_framework/filters/django_filter.html deleted file mode 100644 index b116e3531..000000000 --- a/rest_framework/templates/rest_framework/filters/django_filter.html +++ /dev/null @@ -1,6 +0,0 @@ -{% load i18n %} -

{% trans "Field filters" %}

-
- {{ filter.form.as_p }} - -
diff --git a/rest_framework/templates/rest_framework/filters/django_filter_crispyforms.html b/rest_framework/templates/rest_framework/filters/django_filter_crispyforms.html deleted file mode 100644 index 171767c08..000000000 --- a/rest_framework/templates/rest_framework/filters/django_filter_crispyforms.html +++ /dev/null @@ -1,5 +0,0 @@ -{% load crispy_forms_tags %} -{% load i18n %} - -

{% trans "Field filters" %}

-{% crispy filter.form %} diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py index 7002f0b9f..264b6444c 100644 --- a/rest_framework/templatetags/rest_framework.py +++ b/rest_framework/templatetags/rest_framework.py @@ -11,8 +11,8 @@ from django.utils.html import escape, format_html, smart_urlquote from django.utils.safestring import SafeData, mark_safe from rest_framework.compat import ( - NoReverseMatch, markdown, pygments_highlight, reverse, template_render, - md_filter_add_syntax_highlight, + NoReverseMatch, apply_markdown, pygments_highlight, reverse, + template_render ) from rest_framework.renderers import HTMLFormRenderer from rest_framework.utils.urls import replace_query_param @@ -69,14 +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 - md = markdown.Markdown() - - # add pygments syntax highlight if pygments package is available - md_filter_add_syntax_highlight(md) - - return mark_safe(md.convert(markdown_text)) + return mark_safe(apply_markdown(markdown_text)) @register.simple_tag