Merge branch 'RyanPineo-fix-page-edit-publish-view-live-url'

This commit is contained in:
Matt Westcott 2015-10-14 17:16:34 +01:00
commit 148f05e0d2
5 changed files with 13 additions and 2 deletions

View file

@ -28,6 +28,7 @@ Changelog
* Fix: request.site now set correctly on page preview when the page is not in the default site
* Fix: Project template no longer raises a deprecation warning (Maximilian Stauss)
* Fix: `PageManager.sibling_of(page)` and `PageManager.not_sibling_of(page)` now default to inclusive (i.e. `page` is considered a sibling of itself), for consistency with other sibling methods
* Fix: The "view live" button displayed after publishing a page now correctly reflects any changes made to the page slug (Ryan Pineo)
1.1 (15.09.2015)

View file

@ -70,6 +70,7 @@ Contributors
* Maximilian Stauss
* Salvador Faria
* Alex Gleason
* Ryan Pineo
Translators

View file

@ -64,6 +64,7 @@ Bug fixes
* ``request.site`` now set correctly on page preview when the page is not in the default site
* Project template no longer raises a deprecation warning (Maximilian Stauss)
* ``PageManager.sibling_of(page)`` and ``PageManager.not_sibling_of(page)`` now default to inclusive (i.e. ``page`` is considered a sibling of itself), for consistency with other sibling methods
* The "view live" button displayed after publishing a page now correctly reflects any changes made to the page slug (Ryan Pineo)
Upgrade considerations

View file

@ -670,10 +670,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, )))
@ -696,6 +696,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)

View file

@ -236,6 +236,9 @@ def edit(request, page_id):
# Publish
if is_publishing:
revision.publish()
# Need to reload the page because the URL may have changed, and we
# need the up-to-date URL for the "View Live" button.
page = Page.objects.get(pk=page.pk)
# Notifications
if is_publishing: