mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-14 10:13:13 +00:00
Fix page edit publish "View Live" url
This commit is contained in:
parent
e955f7da4c
commit
8a3304c147
2 changed files with 10 additions and 2 deletions
|
|
@ -671,10 +671,10 @@ class TestPageEdit(TestCase, WagtailTestUtils):
|
|||
post_data = {
|
||||
'title': "I've been edited!",
|
||||
'content': "Some content",
|
||||
'slug': 'hello-world',
|
||||
'slug': 'hello-world-new',
|
||||
'action-publish': "Publish",
|
||||
}
|
||||
response = self.client.post(reverse('wagtailadmin_pages:edit', args=(self.child_page.id, )), post_data)
|
||||
response = self.client.post(reverse('wagtailadmin_pages:edit', args=(self.child_page.id, )), post_data, follow=True)
|
||||
|
||||
# Should be redirected to explorer
|
||||
self.assertRedirects(response, reverse('wagtailadmin_explore', args=(self.root_page.id, )))
|
||||
|
|
@ -697,6 +697,11 @@ class TestPageEdit(TestCase, WagtailTestUtils):
|
|||
# first_published_at should not change as it was already set
|
||||
self.assertEqual(first_published_at, child_page_new.first_published_at)
|
||||
|
||||
# The "View Live" button should have the updated slug.
|
||||
for message in response.context['messages']:
|
||||
self.assertIn('hello-world-new', message.message)
|
||||
break
|
||||
|
||||
def test_edit_post_publish_scheduled(self):
|
||||
go_live_at = timezone.now() + timedelta(days=1)
|
||||
expire_at = timezone.now() + timedelta(days=2)
|
||||
|
|
|
|||
|
|
@ -251,6 +251,9 @@ def edit(request, page_id):
|
|||
# Publish
|
||||
if is_publishing:
|
||||
revision.publish()
|
||||
# Need to reload the page because the url has changed and we
|
||||
# need access to it for the "View Live" button.
|
||||
page = Page.objects.get(pk=page.pk)
|
||||
|
||||
# Notifications
|
||||
if is_publishing:
|
||||
|
|
|
|||
Loading…
Reference in a new issue