diff --git a/wagtail/admin/tests/test_buttons_hooks.py b/wagtail/admin/tests/test_buttons_hooks.py index 766d94626b..04e170ae46 100644 --- a/wagtail/admin/tests/test_buttons_hooks.py +++ b/wagtail/admin/tests/test_buttons_hooks.py @@ -230,7 +230,7 @@ class TestPageListingMoreButtonsHooks(TestButtonsHooks): button for button in buttons if button.label == "Sort menu order" ) - self.assertEqual(reorder_button.url, "?ordering=ord") + self.assertEqual(reorder_button.url, "/admin/pages/%d/?ordering=ord" % page.id) class TestPageHeaderButtonsHooks(TestButtonsHooks): diff --git a/wagtail/admin/wagtail_hooks.py b/wagtail/admin/wagtail_hooks.py index c6845bba6c..b09b6b818d 100644 --- a/wagtail/admin/wagtail_hooks.py +++ b/wagtail/admin/wagtail_hooks.py @@ -368,6 +368,10 @@ class PageListingSortMenuOrderButton(PageListingButton): def show(self): return self.page_perms.can_reorder_children() + @cached_property + def url(self): + return reverse("wagtailadmin_explore", args=[self.page.id]) + "?ordering=ord" + @hooks.register("register_page_listing_more_buttons") def page_listing_more_buttons(page, page_perms, next_url=None): @@ -432,7 +436,6 @@ def page_listing_more_buttons(page, page_perms, next_url=None): yield PageListingSortMenuOrderButton( page=page, page_perms=page_perms, - url="?ordering=ord", priority=60, ) @@ -487,7 +490,6 @@ def page_header_buttons(page, page_perms, next_url=None): yield PageListingSortMenuOrderButton( page=page, page_perms=page_perms, - url=reverse("wagtailadmin_explore", args=[page.id]) + "?ordering=ord", priority=70, )