X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6d42bc478e3d1bd90eb294464748c21e4de0fc63..94ca8037f9a5891b7ded1c92c639e0fbc676e67b:/src/contact/fields.py diff --git a/src/contact/fields.py b/src/contact/fields.py index 578776aa7..f737f03b4 100644 --- a/src/contact/fields.py +++ b/src/contact/fields.py @@ -2,6 +2,8 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django import forms +from django.utils.html import conditional_escape +from django.utils.safestring import mark_safe from .widgets import HeaderWidget @@ -9,4 +11,12 @@ class HeaderField(forms.CharField): def __init__(self, required=False, widget=None, *args, **kwargs): if widget is None: widget = HeaderWidget - super(HeaderField, self).__init__(required=required, widget=widget, *args, **kwargs) + super(HeaderField, self).__init__(required=False, widget=widget, *args, **kwargs) + self.label = mark_safe('' + conditional_escape(self.label) + '') + self.label_suffix = '' + + +class SeparatorField(HeaderField): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.label = ''