From f4fb9fc065802f019059dcdfed065e5f85b6e6c9 Mon Sep 17 00:00:00 2001 From: TheAMM Date: Tue, 30 May 2017 19:20:00 +0300 Subject: [PATCH] Render markdown text field manually in the template We need to escape newlines in the editor as well! --- nyaa/templates/_formhelpers.html | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/nyaa/templates/_formhelpers.html b/nyaa/templates/_formhelpers.html index 212c753..d9e960a 100644 --- a/nyaa/templates/_formhelpers.html +++ b/nyaa/templates/_formhelpers.html @@ -50,7 +50,25 @@
- {{ render_field(field, False, class_='form-control markdown-source') }} + {# Render this field manually, because we need to escape the inner text #} + + {% if field.errors %} +
+ {% if field.errors|length < 2 %} + {% for error in field.errors %} + {{ error }} + {% endfor %} + {% else %} +
    + {% for error in field.errors %} +
  • {{ error }}
  • + {% endfor %} +
+ {% endif %} +
+ {% endif %}