X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/652e2d66d7f88cc6b857edc4aaac7e14a654eb36..ddf2102eff7ea420a4ea5144c43409587fc1156e:/src/ajaxable/templatetags/ajaxable_tags.py diff --git a/src/ajaxable/templatetags/ajaxable_tags.py b/src/ajaxable/templatetags/ajaxable_tags.py index c262a92c3..a9a308d51 100644 --- a/src/ajaxable/templatetags/ajaxable_tags.py +++ b/src/ajaxable/templatetags/ajaxable_tags.py @@ -1,11 +1,12 @@ -# -*- coding: utf-8 -*- # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django import template +from django.utils.encoding import force_str from django.utils.safestring import mark_safe - from ajaxable.utils import placeholdized + + register = template.Library() @@ -26,8 +27,14 @@ def pretty_field(field, template=None):
  • %(errors)s + %(helptext)s
  • ''' - return mark_safe(template % {'errors': field.errors, 'input': field, 'label': field.label}) + return mark_safe(template % { + 'errors': field.errors, + 'input': field, + 'label': ('*' if field.field.required else '') + force_str(field.label), + 'helptext': force_str(field.help_text), + }) @register.filter @@ -36,4 +43,5 @@ def pretty_checkbox(field):
  • %(errors)s + %(helptext)s
  • ''')