kopia lustrzana https://github.com/wagtail/wagtail
				
				
				
			Exclude `latest_revision` when creating a page alias
- Fix alias of draft page for non-primary locale showing links to the incorrect edit form - Fixes #13090 - Relates to #13100pull/13222/head
							rodzic
							
								
									0ac7c158b7
								
							
						
					
					
						commit
						800a2dbd28
					
				| 
						 | 
				
			
			@ -65,6 +65,7 @@
 | 
			
		|||
 * Fix: Make sure the label of panel collapse buttons is translatable (Thibaud Colas)
 | 
			
		||||
 * Fix: Ensure there is suitable padding for large numbers on pagination within universal listings (M. Sumair Khokhar)
 | 
			
		||||
 * Fix: Use the correct localized format utils in the `human_readable_date` template tag (Seb Corbin)
 | 
			
		||||
 * Fix: Ensure the editing of translation alias pages correctly shows links to the source page if the alias was created from a draft (Dan Braghis)
 | 
			
		||||
 * Docs: Add missing tag library imports to footer template code in tutorial (Dimaco)
 | 
			
		||||
 * Docs: Improve documentation around securing user-uploaded files (Jake Howard)
 | 
			
		||||
 * Docs: Introduce search_fields in a dedicated tutorial section instead of the introduction (Matt Westcott)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,6 +109,7 @@ For more details, see the documentation on [enabling the user bar](headless_user
 | 
			
		|||
 * Make sure the label of panel collapse buttons is translatable (Thibaud Colas)
 | 
			
		||||
 * Ensure there is suitable padding for large numbers on pagination within universal listings (M. Sumair Khokhar)
 | 
			
		||||
 * Use the correct localized format utils in the `human_readable_date` template tag (Seb Corbin)
 | 
			
		||||
 * Ensure the editing of translation alias pages correctly shows links to the source page if the alias was created from a draft (Dan Braghis)
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,6 +120,7 @@ class CreatePageAliasAction:
 | 
			
		|||
            "path",
 | 
			
		||||
            "index_entries",
 | 
			
		||||
            "postgres_index_entries",
 | 
			
		||||
            "latest_revision",  # for page aliases do not have revisions
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
        update_attrs = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2139,6 +2139,31 @@ class TestPageEdit(WagtailTestUtils, TestCase):
 | 
			
		|||
            html=True,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_edit_alias_page_from_draft_page(self):
 | 
			
		||||
        # Ensure we have at least one revision. This is what happens when creating
 | 
			
		||||
        # a page via the admin. It is stored as latest_revision
 | 
			
		||||
        self.unpublished_page.save_revision()
 | 
			
		||||
        alias_page = self.unpublished_page.create_alias(update_slug="an-alias-page")
 | 
			
		||||
        response = self.client.get(
 | 
			
		||||
            reverse("wagtailadmin_pages:edit", args=[alias_page.id])
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        self.assertEqual(response.status_code, 200)
 | 
			
		||||
        self.assertEqual(response["Content-Type"], "text/html; charset=utf-8")
 | 
			
		||||
 | 
			
		||||
        self.assertNotContains(response, 'id="status-sidebar-live"')
 | 
			
		||||
 | 
			
		||||
        # Check the edit_alias.html template was used instead
 | 
			
		||||
        self.assertTemplateUsed(response, "wagtailadmin/pages/edit_alias.html")
 | 
			
		||||
        original_page_edit_url = reverse(
 | 
			
		||||
            "wagtailadmin_pages:edit", args=[self.unpublished_page.id]
 | 
			
		||||
        )
 | 
			
		||||
        self.assertContains(
 | 
			
		||||
            response,
 | 
			
		||||
            f'<a class="button button-secondary" href="{original_page_edit_url}">Edit original page</a>',
 | 
			
		||||
            html=True,
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_post_edit_alias_page(self):
 | 
			
		||||
        alias_page = self.child_page.create_alias(update_slug="new-child-page")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue