kopia lustrzana https://github.com/wagtail/wagtail
Ensure confirmation page respects custom get_admin_display_title methods
rodzic
0fb7417bca
commit
cd3bec0433
|
@ -71,11 +71,9 @@ class TestBulkMove(TestCase, WagtailTestUtils):
|
|||
|
||||
self.assertInHTML('<p>Are you sure you want to move these pages?</p>', html)
|
||||
|
||||
for child_page in self.pages_to_be_moved:
|
||||
self.assertInHTML('<li><a href="{edit_page_url}" target="_blank" rel="noopener noreferrer">{page_title}</a></li>'.format(
|
||||
edit_page_url=reverse('wagtailadmin_pages:edit', args=[child_page.id]),
|
||||
page_title=child_page.title
|
||||
), html)
|
||||
self.assertInHTML('<li><a href="{edit_page_url}" target="_blank" rel="noopener noreferrer">Hello world! (simple page)</a></li>'.format(
|
||||
edit_page_url=reverse('wagtailadmin_pages:edit', args=[self.test_page_b.id]),
|
||||
), html)
|
||||
|
||||
def test_bulk_move_bad_permissions(self):
|
||||
# Remove privileges from user
|
||||
|
|
|
@ -50,6 +50,9 @@ class TestBulkPublish(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
self.assertTemplateUsed(response, 'wagtailadmin/pages/bulk_actions/confirm_bulk_publish.html')
|
||||
|
||||
# Page titles shown on the confirmation page should use SimplePage's custom get_admin_display_title method
|
||||
self.assertContains(response, "Hello world!-1 (simple page)")
|
||||
|
||||
def test_publish_view_invalid_page_id(self):
|
||||
"""
|
||||
This tests that the publish view returns an error if the page id is invalid
|
||||
|
|
|
@ -28,6 +28,12 @@ class PageBulkAction(BulkAction):
|
|||
|
||||
return listing_objects
|
||||
|
||||
def object_context(self, obj):
|
||||
context = super().object_context(obj)
|
||||
# Make 'item' into the specific instance, so that custom get_admin_display_title methods are respected
|
||||
context['item'] = context['item'].specific_deferred
|
||||
return context
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['items_with_no_access'] = [
|
||||
|
|
Ładowanie…
Reference in New Issue