kopia lustrzana https://github.com/wagtail/wagtail
rodzic
01c37c107c
commit
c7a0d6ef95
|
@ -46,6 +46,7 @@ Changelog
|
|||
* Fix: Remove unused header search JavaScript on the redirects import page (LB (Ben) Johnston)
|
||||
* Fix: Ensure non-square avatar images will correctly show throughout the admin (LB (Ben) Johnston)
|
||||
* Fix: Ignore translations in test files and re-include some translations that were accidentally ignored (Stefan Hammer)
|
||||
* Fix: Show alternative message when no page types are available to be created (Jaspreet Singh)
|
||||
|
||||
|
||||
3.0.1 (xx.xx.xxxx) - IN DEVELOPMENT
|
||||
|
|
|
@ -601,6 +601,7 @@ Contributors
|
|||
* Thiago Costa de Souza
|
||||
* Benedict Faw
|
||||
* Lucie Le Frapper
|
||||
* Jaspreet Singh
|
||||
|
||||
Translators
|
||||
===========
|
||||
|
|
|
@ -60,6 +60,7 @@ When using a queryset to render a list of images, you can now use the ``prefetch
|
|||
* Remove unused header search JavaScript on the redirects import page (LB (Ben) Johnston)
|
||||
* Ensure non-square avatar images will correctly show throughout the admin (LB (Ben) Johnston)
|
||||
* Ignore translations in test files and re-include some translations that were accidentally ignored (Stefan Hammer)
|
||||
* Show alternative message when no page types are available to be created (Jaspreet Singh)
|
||||
|
||||
|
||||
## Upgrade considerations
|
||||
|
|
|
@ -9,7 +9,11 @@
|
|||
{% include "wagtailadmin/shared/header.html" with title=create_str subtitle=parent_page.get_admin_display_title icon="doc-empty-inverse" %}
|
||||
|
||||
<div class="nice-padding">
|
||||
<p>{% trans "Choose which type of page you'd like to create." %}</p>
|
||||
{% if page_types %}
|
||||
<p>{% trans "Choose which type of page you'd like to create." %}</p>
|
||||
{% else %}
|
||||
<p>{% trans "Sorry, you cannot create a page at this location." %}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if page_types %}
|
||||
<ul class="listing">
|
||||
|
|
|
@ -19,7 +19,9 @@ from wagtail.test.testapp.models import (
|
|||
BusinessSubIndex,
|
||||
DefaultStreamPage,
|
||||
PersonPage,
|
||||
SimpleChildPage,
|
||||
SimplePage,
|
||||
SimpleParentPage,
|
||||
SingletonPage,
|
||||
SingletonPageViaMaxCount,
|
||||
StandardChild,
|
||||
|
@ -73,6 +75,30 @@ class TestPageCreation(TestCase, WagtailTestUtils):
|
|||
# List should not contain page types not in the subpage_types list
|
||||
self.assertNotContains(response, "Simple page")
|
||||
|
||||
def test_no_subpage_type_available_to_create(self):
|
||||
# Test if all subpages have reached their max_count_per_parent limit
|
||||
simple_parent_page = SimpleParentPage(
|
||||
title="Hello World!",
|
||||
slug="hello-world",
|
||||
)
|
||||
self.root_page.add_child(instance=simple_parent_page)
|
||||
simple_child_page = SimpleChildPage(
|
||||
title="Hello World!",
|
||||
slug="hello-world",
|
||||
)
|
||||
simple_parent_page.add_child(instance=simple_child_page)
|
||||
response = self.client.get(
|
||||
reverse("wagtailadmin_pages:add_subpage", args=(simple_parent_page.id,))
|
||||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
# if there is no page_type available then this message should be shown.
|
||||
self.assertContains(
|
||||
response, "Sorry, you cannot create a page at this location."
|
||||
)
|
||||
self.assertNotContains(
|
||||
response, "Choose which type of page you'd like to create."
|
||||
)
|
||||
|
||||
def test_add_subpage_with_one_valid_subpage_type(self):
|
||||
# Add a BusinessSubIndex to test business rules in
|
||||
business_index = BusinessIndex(
|
||||
|
|
Ładowanie…
Reference in New Issue