mark required fields in ajaxable forms
[wolnelektury.git] / src / ajaxable / templatetags / ajaxable_tags.py
index 55059e5..9af58e9 100644 (file)
@@ -32,14 +32,14 @@ def pretty_field(field, template=None):
     return mark_safe(template % {
         'errors': field.errors,
         'input': field,
-        'label': force_unicode(field.label),
+        'label': ('*' if field.field.required else '') + force_unicode(field.label),
         'helptext': force_unicode(field.help_text),
     })
 
 
 @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>