fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Python 3
[wolnelektury.git]
/
src
/
ajaxable
/
templatetags
/
ajaxable_tags.py
diff --git
a/src/ajaxable/templatetags/ajaxable_tags.py
b/src/ajaxable/templatetags/ajaxable_tags.py
index
72b9baa
..
d327e2e
100644
(file)
--- a/
src/ajaxable/templatetags/ajaxable_tags.py
+++ b/
src/ajaxable/templatetags/ajaxable_tags.py
@@
-3,6
+3,7
@@
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django import template
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django import template
+from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
from ajaxable.utils import placeholdized
from django.utils.safestring import mark_safe
from ajaxable.utils import placeholdized
@@
-22,7
+23,7
@@
def placeholdized_ul(form):
@register.filter
def pretty_field(field, template=None):
if template is None:
@register.filter
def pretty_field(field, template=None):
if template is None:
- template = '''
+ template =
u
'''
<li>
<span class="error">%(errors)s</span>
<label class="nohide"><span class="label">%(label)s: </span>%(input)s</label>
<li>
<span class="error">%(errors)s</span>
<label class="nohide"><span class="label">%(label)s: </span>%(input)s</label>
@@
-31,14
+32,14
@@
def pretty_field(field, template=None):
return mark_safe(template % {
'errors': field.errors,
'input': field,
return mark_safe(template % {
'errors': field.errors,
'input': field,
- 'label':
field.label
,
- 'helptext': f
ield.help_text
,
+ 'label':
('*' if field.field.required else '') + force_text(field.label)
,
+ 'helptext': f
orce_text(field.help_text)
,
})
@register.filter
def pretty_checkbox(field):
})
@register.filter
def pretty_checkbox(field):
- return pretty_field(field, template='''
+ return pretty_field(field, template=
u
'''
<li class="checkbox">
<span class="error">%(errors)s</span>
<label class="nohide">%(input)s<span class="label"> %(label)s</span></label>
<li class="checkbox">
<span class="error">%(errors)s</span>
<label class="nohide">%(input)s<span class="label"> %(label)s</span></label>