diff options
Diffstat (limited to 'common/templatetags')
-rw-r--r-- | common/templatetags/__init__.py | 0 | ||||
-rw-r--r-- | common/templatetags/validation.py | 12 |
2 files changed, 12 insertions, 0 deletions
diff --git a/common/templatetags/__init__.py b/common/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/common/templatetags/__init__.py diff --git a/common/templatetags/validation.py b/common/templatetags/validation.py new file mode 100644 index 00000000..40c48da9 --- /dev/null +++ b/common/templatetags/validation.py @@ -0,0 +1,12 @@ +from django import template + +register = template.Library() + +@register.inclusion_tag('errors.html') +def print_errors(errors): + errs = [] + for e,msg in errors.iteritems(): + errmsg = str(msg[0]) + # hack -- I'm a python idiot + errs.append( (e, errmsg[2:-2]) ) + return {'errors': errs} |