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>
30 return mark_safe(template % {'errors': field.errors, 'input': field, 'label': field.label})
34 def pretty_checkbox(field):
35 return pretty_field(field, template='''
37 <span class="error">%(errors)s</span>
38 <label class="nohide">%(input)s<span class="label"> %(label)s</span></label>