1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django import forms
5 from django.utils.html import conditional_escape
6 from django.utils.safestring import mark_safe
7 from .widgets import HeaderWidget
10 class HeaderField(forms.CharField):
11 def __init__(self, required=False, widget=None, *args, **kwargs):
14 super(HeaderField, self).__init__(required=False, widget=widget, *args, **kwargs)
15 self.label = mark_safe('<b>' + conditional_escape(self.label) + '</b>')
16 self.label_suffix = ''
19 class SeparatorField(HeaderField):
20 def __init__(self, *args, **kwargs):
21 super().__init__(*args, **kwargs)