X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/98b2c09ef1f1c8288a31517f61423264c6b3291c..eaba19e725b49fdf4efc858604a7b9d70d27f59f:/src/contact/fields.py?ds=sidebyside diff --git a/src/contact/fields.py b/src/contact/fields.py index c2c97b307..f737f03b4 100644 --- a/src/contact/fields.py +++ b/src/contact/fields.py @@ -1,8 +1,9 @@ -# -*- coding: utf-8 -*- # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # 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 @@ -10,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 = ''