render markdown directly in template

This commit is contained in:
aron bergur jóhannsson 2023-03-08 11:14:38 +00:00
parent 58a7216d2d
commit ed9e95911c

View File

@ -893,17 +893,8 @@ class JobResultBulkDeleteView(generic.BulkDeleteView):
#
class MarkdownRenderView(View):
# _ignore_model_permissions = True
template_code = """
{% if text %}
{{ text|markdown }}
{% else %}
—
{% endif %}
"""
def post(self, request):
context = {
"text": request.POST.get("text", "")
}
return HttpResponse(Template(self.template_code).render(Context(context)).strip())
return HttpResponse(Template("{{text|markdown}}").render(Context(context)).strip())