From: Radek Czajka Date: Mon, 16 Aug 2021 13:10:18 +0000 (+0200) Subject: Split form intro. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/2d7cd9e42f2c3bc682ffb13ebc1644e102590102?ds=sidebyside;hp=b89ddf83530285bc57f8c176089cbb769ffe953b Split form intro. --- 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 '' +