Commit 0281205f authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

put non_form_errors in bootstrap4 alert

parent 1ec70ca0
......@@ -96,7 +96,7 @@ window.onload = function() {
{% if wizard.form.forms is not None %}
{{ wizard.form.management_form }}
{{ formset.management_form }}
{{ wizard.form.non_form_errors|bootstrap }}
{% for form in wizard.form.forms %}
{# Include the hidden fields #}
{% for hidden in form.hidden_fields %}
......
......@@ -4,7 +4,7 @@
{{form|bootstrap}}
<div class="formset-nested-encloser">
{{ form.nested.management_form }}
{{ form.nested.non_form_errors }}
{{ form.nested.non_form_errors|bootstrap }}
{% if nested_form %}
<div class="formset-nested-item">
{{ nested_form|bootstrap }}
......
......@@ -2,6 +2,7 @@ import logging
from django import forms
from django import template
from django.forms.utils import ErrorList
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext
......@@ -98,6 +99,9 @@ def bootstrap_core(object):
for field in form:
for l in bootstrap_core(field):
ret.append(l)
elif isinstance(object, ErrorList):
for error in object:
ret.append("""<div class="alert alert-danger">%s</div>""" % error.replace("\n", "<br/>"))
else:
ret.append("""<div class="alert alert-danger">Can't bootstrapize object of class %s</div>""" %
str(type(object).__name__))
......@@ -106,4 +110,4 @@ def bootstrap_core(object):
@register.filter('startswith')
def startswith(text, starts):
return text.startswith(starts)
return text.startswith(starts)
\ No newline at end of file
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