Split form intro.
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 16 Aug 2021 13:10:18 +0000 (15:10 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 16 Aug 2021 13:10:18 +0000 (15:10 +0200)
src/wolnelektury/templates/forms/includes/built_form.html
src/wolnelektury/templatetags/more.py [new file with mode: 0644]

index 009bc5f..aaf4ade 100644 (file)
@@ -1,10 +1,10 @@
 {% load honeypot %}
 {% load honeypot %}
-{% load chunks %}
+{% load more %}
 
 <h1>{{ form.title }}</h1>
 
     <div class="form-info">
 
 <h1>{{ form.title }}</h1>
 
     <div class="form-info">
-       {{ form.intro|safe }}
+       {{ form.intro|first_part:"---"|safe }}
     </div>
 
     {{ form_for_form.media }}
     </div>
 
     {{ form_for_form.media }}
@@ -21,5 +21,5 @@
 
 
     <div class="form-info">
 
 
     <div class="form-info">
-        {% chunk 'formularz_'|add:form.slug %}
+       {{ form.intro|second_part:"---"|safe }}
     </div>
     </div>
diff --git a/src/wolnelektury/templatetags/more.py b/src/wolnelektury/templatetags/more.py
new file mode 100644 (file)
index 0000000..ee760d7
--- /dev/null
@@ -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 ''
+