mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Style Django form nonfield error the same as help-critical
This commit is contained in:
parent
d359faf321
commit
3e5583e0fe
@ -1,12 +1,16 @@
|
|||||||
{% extends "wagtailadmin/generic/base.html" %}
|
{% extends "wagtailadmin/generic/base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n wagtailadmin_tags %}
|
||||||
|
|
||||||
{% block main_content %}
|
{% block main_content %}
|
||||||
{% block before_form %}{% endblock %}
|
{% block before_form %}{% endblock %}
|
||||||
<form action="{{ action_url }}" method="POST" novalidate{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
<form action="{{ action_url }}" method="POST" novalidate{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
{{ form.non_field_errors }}
|
{% block non_field_errors %}
|
||||||
|
{% for error in form.non_field_errors %}
|
||||||
|
{% help_block status="critical" %}{{ error }}{% endhelp_block %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block hidden_fields %}
|
{% block hidden_fields %}
|
||||||
{% for field in form.hidden_fields %}{{ field }}{% endfor %}
|
{% for field in form.hidden_fields %}{{ field }}{% endfor %}
|
||||||
|
@ -154,9 +154,12 @@ class TestSiteCreateView(WagtailTestUtils, TestCase):
|
|||||||
{"hostname": "localhost", "port": "80", "root_page": str(self.home_page.id)}
|
{"hostname": "localhost", "port": "80", "root_page": str(self.home_page.id)}
|
||||||
)
|
)
|
||||||
expected_html = """
|
expected_html = """
|
||||||
<ul class="errorlist nonfield">
|
<div class="help-block help-critical">
|
||||||
<li>Site with this Hostname and Port already exists.</li>
|
<svg class="icon icon-warning icon" aria-hidden="true">
|
||||||
</ul>
|
<use href="#icon-warning"></use>
|
||||||
|
</svg>
|
||||||
|
Site with this Hostname and Port already exists.
|
||||||
|
</div>
|
||||||
"""
|
"""
|
||||||
self.assertTagInHTML(expected_html, str(response.content))
|
self.assertTagInHTML(expected_html, str(response.content))
|
||||||
|
|
||||||
@ -283,13 +286,13 @@ class TestSiteEditView(WagtailTestUtils, TestCase):
|
|||||||
hostname="something_different",
|
hostname="something_different",
|
||||||
port=80,
|
port=80,
|
||||||
is_default_site=False,
|
is_default_site=False,
|
||||||
root_page=self.home_page
|
root_page=self.home_page,
|
||||||
)
|
)
|
||||||
response = self.post(
|
response = self.post(
|
||||||
{
|
{
|
||||||
'hostname': "Localhost",
|
"hostname": "Localhost",
|
||||||
},
|
},
|
||||||
site_id=second_site.id
|
site_id=second_site.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Should return the form with errors
|
# Should return the form with errors
|
||||||
@ -304,18 +307,21 @@ class TestSiteEditView(WagtailTestUtils, TestCase):
|
|||||||
hostname="something_different",
|
hostname="something_different",
|
||||||
port=80,
|
port=80,
|
||||||
is_default_site=False,
|
is_default_site=False,
|
||||||
root_page=self.home_page
|
root_page=self.home_page,
|
||||||
)
|
)
|
||||||
response = self.post(
|
response = self.post(
|
||||||
{
|
{
|
||||||
'hostname': "Localhost",
|
"hostname": "Localhost",
|
||||||
},
|
},
|
||||||
site_id=second_site.id
|
site_id=second_site.id,
|
||||||
)
|
)
|
||||||
expected_html = """
|
expected_html = """
|
||||||
<ul class="errorlist nonfield">
|
<div class="help-block help-critical">
|
||||||
<li>Site with this Hostname and Port already exists.</li>
|
<svg class="icon icon-warning icon" aria-hidden="true">
|
||||||
</ul>
|
<use href="#icon-warning"></use>
|
||||||
|
</svg>
|
||||||
|
Site with this Hostname and Port already exists.
|
||||||
|
</div>
|
||||||
"""
|
"""
|
||||||
self.assertTagInHTML(expected_html, str(response.content))
|
self.assertTagInHTML(expected_html, str(response.content))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user