Commit 81f5f74c authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Normally we should receive ErrorDict, but in case we do

parent 324600c1
......@@ -3,7 +3,7 @@ import logging
from django import forms
from django import template
from import Message
from django.forms.utils import ErrorList
from django.forms.utils import ErrorList, ErrorDict
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext
......@@ -115,6 +115,13 @@ def bootstrap_core(object):
# print errors in a bootstrap way
for error in object:
ret.append("""<div class="alert alert-danger">%s</div>""" % error.replace("\n", "<br/>"))
elif isinstance(object, ErrorDict):
# print errors in a bootstrap way
for key, error in object.items():
ret.append('<div class="alert alert-danger"><b>%s:</b>' % key)
for line in bootstrap_core(error):
elif isinstance(object, Message):
# print messages in a bootstrap way
message = object
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment