Fix: Use specific page model for the parent page in the explore index

pull/3082/head
Gagaro 2016-10-07 12:19:55 +02:00 zatwierdzone przez Matt Westcott
rodzic ee4e2ed27b
commit 49421e5a41
4 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -8,6 +8,7 @@ Changelog
* Added `get_landing_page_template` getter method to `AbstractForm` (Gagaro)
* Added `Page.get_admin_display_title` method to override how the title is displayed in the admin (Henk-Jan van Hasselaar)
* Fix: `AbstractForm` now respects custom `get_template` methods on the page model (Gagaro)
* Fix: Use specific page model for the parent page in the explore index (Gagaro)
1.7 (xx.xx.xxxx) - IN DEVELOPMENT

Wyświetl plik

@ -23,6 +23,7 @@ Bug fixes
~~~~~~~~~
* ``AbstractForm`` now respects custom ``get_template`` methods on the page model (Gagaro)
* Use specific page model for the parent page in the explore index (Gagaro)
Upgrade considerations

Wyświetl plik

@ -237,6 +237,12 @@ class TestPageExplorer(TestCase, WagtailTestUtils):
self.assertContains(response, '/new-event/pointless-suffix/')
def test_parent_page_is_specific(self):
response = self.client.get(reverse('wagtailadmin_explore', args=(self.child_page.id, )))
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.context['parent_page'], SimplePage)
class TestPageExplorerSignposting(TestCase, WagtailTestUtils):
fixtures = ['test.json']

Wyświetl plik

@ -38,9 +38,9 @@ def explorer_nav(request):
def index(request, parent_page_id=None):
if parent_page_id:
parent_page = get_object_or_404(Page, id=parent_page_id)
parent_page = get_object_or_404(Page, id=parent_page_id).specific
else:
parent_page = Page.get_first_root_node()
parent_page = Page.get_first_root_node().specific
pages = parent_page.get_children().prefetch_related('content_type')