Skip to content
Snippets Groups Projects
Commit 2ab2b45d authored by Dan Braghis's avatar Dan Braghis
Browse files

Add non-field errors to the forms

parent f9997d71
No related branches found
No related tags found
No related merge requests found
{% extends "base.html" %}
{% load wagtailcore_tags %}
{% block content %}
<h1>{{ page.title }}</h1>
<form action="{% pageurl page %}" method="POST">
{% csrf_token %}
{% if form.errors or form.non_field_errors %}
<div class="messages">
There were some errors with your form. Please amend the fields highlighted below. {% if form.non_field_errors %}
<ul>
{% for error in form.non_field_errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
{{ form.as_p }}
<input type="submit">
</form>
......
......@@ -18,8 +18,17 @@
<div>
{% csrf_token %}
{% if form.errors %}
There were some errors with your form. Please amend the fields highlighted below.
{% if form.errors or form.non_field_errors %}
<div class="messages">
There were some errors with your form. Please amend the fields highlighted below.
{% if form.non_field_errors %}
<ul>
{% for error in form.non_field_errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
{% for field in form %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment