Better management of manually-set members.
[wolnelektury.git] / src / contact / fields.py
index 578776a..f737f03 100644 (file)
@@ -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('<b>' + conditional_escape(self.label) + '</b>')
+        self.label_suffix = ''
+
+
+class SeparatorField(HeaderField):
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self.label = ''