From 2d7cd9e42f2c3bc682ffb13ebc1644e102590102 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 16 Aug 2021 15:10:18 +0200 Subject: [PATCH] Split form intro. --- .../templates/forms/includes/built_form.html | 6 +++--- src/wolnelektury/templatetags/more.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/wolnelektury/templatetags/more.py diff --git a/src/wolnelektury/templates/forms/includes/built_form.html b/src/wolnelektury/templates/forms/includes/built_form.html index 009bc5f76..aaf4adeac 100644 --- a/src/wolnelektury/templates/forms/includes/built_form.html +++ b/src/wolnelektury/templates/forms/includes/built_form.html @@ -1,10 +1,10 @@ {% load honeypot %} -{% load chunks %} +{% load more %}

{{ form.title }}

- {{ form.intro|safe }} + {{ form.intro|first_part:"---"|safe }}
{{ form_for_form.media }} @@ -21,5 +21,5 @@
- {% chunk 'formularz_'|add:form.slug %} + {{ form.intro|second_part:"---"|safe }}
diff --git a/src/wolnelektury/templatetags/more.py b/src/wolnelektury/templatetags/more.py new file mode 100644 index 000000000..ee760d7a3 --- /dev/null +++ b/src/wolnelektury/templatetags/more.py @@ -0,0 +1,16 @@ +from django.template import Library + + +register = Library() + + +@register.filter +def first_part(txt, sep): + return txt.split(sep, 1)[0] + + +@register.filter +def second_part(txt, sep): + parts = txt.split(sep, 1) + return parts[1] if len(parts) > 1 else '' + -- 2.20.1