1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django import template
6 from django.utils.safestring import mark_safe
8 from ajaxable.utils import placeholdized
9 register = template.Library()
13 def placeholdize(form):
14 return placeholdized(form)
18 def placeholdized_ul(form):
19 return placeholdized(form).as_ul()
23 def pretty_field(field, template=None):
27 <span class="error">%(errors)s</span>
28 <label class="nohide"><span class="label">%(label)s: </span>%(input)s</label>
29 <span class="helptext">%(helptext)s</span>
31 return mark_safe(template % {
32 'errors': field.errors,
35 'helptext': field.help_text,
40 def pretty_checkbox(field):
41 return pretty_field(field, template='''
43 <span class="error">%(errors)s</span>
44 <label class="nohide">%(input)s<span class="label"> %(label)s</span></label>
45 <span class="helptext">%(helptext)s</span>