single search query with boosts - stub
[wolnelektury.git] / src / ajaxable / templatetags / ajaxable_tags.py
index c262a92..55059e5 100644 (file)
@@ -3,6 +3,7 @@
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 from django import template
+from django.utils.encoding import force_unicode
 from django.utils.safestring import mark_safe
 
 from ajaxable.utils import placeholdized
@@ -26,8 +27,14 @@ def pretty_field(field, template=None):
             <li>
               <span class="error">%(errors)s</span>
               <label class="nohide"><span class="label">%(label)s: </span>%(input)s</label>
+              <span class="helptext">%(helptext)s</span>
             </li>'''
-    return mark_safe(template % {'errors': field.errors, 'input': field, 'label': field.label})
+    return mark_safe(template % {
+        'errors': field.errors,
+        'input': field,
+        'label': force_unicode(field.label),
+        'helptext': force_unicode(field.help_text),
+    })
 
 
 @register.filter
@@ -36,4 +43,5 @@ def pretty_checkbox(field):
         <li class="checkbox">
           <span class="error">%(errors)s</span>
           <label class="nohide">%(input)s<span class="label"> %(label)s</span></label>
+          <span class="helptext">%(helptext)s</span>
         </li>''')