mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Merge remote-tracking branch 'origin/master' into docstrings-with-pygments2
This commit is contained in:
commit
d60a70a850
|
@ -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):
|
||||
"""
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{% load i18n %}
|
||||
<h2>{% trans "Field filters" %}</h2>
|
||||
<form class="form" action="" method="get">
|
||||
{{ filter.form.as_p }}
|
||||
<button type="submit" class="btn btn-primary">{% trans "Submit" %}</button>
|
||||
</form>
|
|
@ -1,5 +0,0 @@
|
|||
{% load crispy_forms_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
<h2>{% trans "Field filters" %}</h2>
|
||||
{% crispy filter.form %}
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user