Ensure breadcrumb respects custom get_admin_display_title methods. Fixes #4353

pull/4415/merge
Matt Westcott 2018-03-22 13:08:49 +00:00
rodzic f92a890303
commit 626418d348
5 zmienionych plików z 19 dodań i 1 usunięć

Wyświetl plik

@ -31,6 +31,7 @@ Changelog
* Fix: Creating a new object with inlines while mandatory fields are empty no longer crashes (Bertrand Bordage)
* Fix: Localization of image and apps verbose names
* Fix: Draftail editor no longer crashes after deleting image/embed using DEL key (Thibaud Colas)
* Fix: Breadcrumb navigation now respects custom `get_admin_display_title` methods (Arthur Holzner, Wietze Helmantel, Matt Westcott)
2.0.1 (xx.xx.xxxx) - IN DEVELOPMENT

Wyświetl plik

@ -287,6 +287,7 @@ Contributors
* Alexs Mathilda
* Tony Yates
* Mike Kamermans
* Arthur Holzner
Translators
===========

Wyświetl plik

@ -49,6 +49,7 @@ Bug fixes
* Creating a new object with inlines while mandatory fields are empty no longer crashes (Bertrand Bordage)
* Localization of image and apps verbose names
* Draftail editor no longer crashes after deleting image/embed using DEL key (Thibaud Colas)
* Breadcrumb navigation now respects custom ``get_admin_display_title`` methods (Arthur Holzner, Wietze Helmantel, Matt Westcott)
Upgrade considerations

Wyświetl plik

@ -60,7 +60,7 @@ def explorer_breadcrumb(context, page, include_self=False):
return {'pages': Page.objects.none()}
return {
'pages': page.get_ancestors(inclusive=include_self).descendant_of(cca, inclusive=True)
'pages': page.get_ancestors(inclusive=include_self).descendant_of(cca, inclusive=True).specific()
}

Wyświetl plik

@ -303,6 +303,21 @@ class TestPageExplorer(TestCase, WagtailTestUtils):
self.assertTemplateUsed(response, 'wagtailadmin/pages/index.html')
class TestBreadcrumb(TestCase, WagtailTestUtils):
fixtures = ['test.json']
def test_breadcrumb_uses_specific_titles(self):
self.user = self.login()
# get the explorer view for a subpage of a SimplePage
page = Page.objects.get(url_path='/home/secret-plans/steal-underpants/')
response = self.client.get(reverse('wagtailadmin_explore', args=(page.id, )))
# The breadcrumb should pick up SimplePage's overridden get_admin_display_title method
expected_url = reverse('wagtailadmin_explore', args=(Page.objects.get(url_path='/home/secret-plans/').id, ))
self.assertContains(response, """<li><a href="%s">Secret plans (simple page)</a></li>""" % expected_url)
class TestPageExplorerSignposting(TestCase, WagtailTestUtils):
fixtures = ['test.json']