kopia lustrzana https://github.com/wagtail/wagtail
Only redirect back to edit page for the save action - not publish or submit
rodzic
f62b0d5d67
commit
9dd493ace7
|
@ -5,7 +5,7 @@ Changelog
|
|||
~~~~~~~~~~~~~~~~
|
||||
|
||||
* Added logging for page operations
|
||||
* The save/publish/submit buttons on the page edit page now redirects the user back to the edit page instead of the explorer
|
||||
* The save button on the page edit page now redirects the user back to the edit page instead of the explorer
|
||||
* Signal handlers for ``wagtail.wagtailsearch`` and ``wagtail.contrib.wagtailfrontendcache`` are now automatically registered when using Django 1.7 or above. (Tim Heap)
|
||||
* Added a Django 1.7 system check to ensure that foreign keys from Page models are set to on_delete=SET_NULL, to prevent inadvertent (and tree-breaking) page deletions
|
||||
* Improved error reporting on image upload, including ability to set a maximum file size via a new setting WAGTAILIMAGES_MAX_UPLOAD_SIZE
|
||||
|
|
|
@ -16,7 +16,7 @@ Minor features
|
|||
~~~~~~~~~~~~~~
|
||||
|
||||
* Page operations (creation, publishing, copying etc) are now logged via Python's ``logging`` framework; to configure this, add a logger entry for ``'wagtail'`` or ``'wagtail.core'`` to the ``LOGGING`` setup in your settings file.
|
||||
* The save/publish/submit buttons on the page edit page now redirects the user back to the edit page instead of the explorer
|
||||
* The save button on the page edit page now redirects the user back to the edit page instead of the explorer
|
||||
* Signal handlers for ``wagtail.wagtailsearch`` and ``wagtail.contrib.wagtailfrontendcache`` are now automatically registered when using Django 1.7 or above.
|
||||
* Added a Django 1.7 system check to ensure that foreign keys from Page models are set to ``on_delete=SET_NULL``, to prevent inadvertent (and tree-breaking) page deletions
|
||||
* Improved error reporting on image upload, including ability to set a maximum file size via a new setting ``WAGTAILIMAGES_MAX_UPLOAD_SIZE``
|
||||
|
|
|
@ -266,8 +266,8 @@ class TestPageCreation(TestCase, WagtailTestUtils):
|
|||
# Find the page and check it
|
||||
page = Page.objects.get(path__startswith=self.root_page.path, slug='hello-world').specific
|
||||
|
||||
# Should be redirected to edit page
|
||||
self.assertRedirects(response, reverse('wagtailadmin_pages_edit', args=(page.id, )))
|
||||
# Should be redirected to explorer
|
||||
self.assertRedirects(response, reverse('wagtailadmin_explore', args=(self.root_page.id, )))
|
||||
|
||||
self.assertEqual(page.title, post_data['title'])
|
||||
self.assertIsInstance(page, SimplePage)
|
||||
|
@ -322,8 +322,8 @@ class TestPageCreation(TestCase, WagtailTestUtils):
|
|||
# Find the page and check it
|
||||
page = Page.objects.get(path__startswith=self.root_page.path, slug='hello-world').specific
|
||||
|
||||
# Should be redirected to edit page
|
||||
self.assertRedirects(response, reverse('wagtailadmin_pages_edit', args=(page.id, )))
|
||||
# Should be redirected to explorer
|
||||
self.assertRedirects(response, reverse('wagtailadmin_explore', args=(self.root_page.id, )))
|
||||
|
||||
self.assertEqual(page.title, post_data['title'])
|
||||
self.assertIsInstance(page, SimplePage)
|
||||
|
@ -550,8 +550,8 @@ class TestPageEdit(TestCase, WagtailTestUtils):
|
|||
}
|
||||
response = self.client.post(reverse('wagtailadmin_pages_edit', args=(self.child_page.id, )), post_data)
|
||||
|
||||
# Should be redirected to edit page
|
||||
self.assertRedirects(response, reverse('wagtailadmin_pages_edit', args=(self.child_page.id, )))
|
||||
# Should be redirected to explorer
|
||||
self.assertRedirects(response, reverse('wagtailadmin_explore', args=(self.root_page.id, )))
|
||||
|
||||
# Check that the page was edited
|
||||
child_page_new = SimplePage.objects.get(id=self.child_page.id)
|
||||
|
@ -652,8 +652,8 @@ class TestPageEdit(TestCase, WagtailTestUtils):
|
|||
}
|
||||
response = self.client.post(reverse('wagtailadmin_pages_edit', args=(self.child_page.id, )), post_data)
|
||||
|
||||
# Should be redirected to edit page
|
||||
self.assertRedirects(response, reverse('wagtailadmin_pages_edit', args=(self.child_page.id, )))
|
||||
# Should be redirected to explorer
|
||||
self.assertRedirects(response, reverse('wagtailadmin_explore', args=(self.root_page.id, )))
|
||||
|
||||
# The page should have "has_unpublished_changes" flag set
|
||||
child_page_new = SimplePage.objects.get(id=self.child_page.id)
|
||||
|
@ -1944,8 +1944,8 @@ class TestIssue197(TestCase, WagtailTestUtils):
|
|||
}
|
||||
response = self.client.post(reverse('wagtailadmin_pages_edit', args=(self.tagged_page.id, )), post_data)
|
||||
|
||||
# Should be redirected to edit page
|
||||
self.assertRedirects(response, reverse('wagtailadmin_pages_edit', args=(self.tagged_page.id, )))
|
||||
# Should be redirected to explorer
|
||||
self.assertRedirects(response, reverse('wagtailadmin_explore', args=(self.root_page.id, )))
|
||||
|
||||
# Check that both tags are in the pages tag set
|
||||
page = TaggedPage.objects.get(id=self.tagged_page.id)
|
||||
|
@ -2032,8 +2032,8 @@ class TestChildRelationsOnSuperclass(TestCase, WagtailTestUtils):
|
|||
}
|
||||
response = self.client.post(reverse('wagtailadmin_pages_edit', args=(self.index_page.id, )), post_data)
|
||||
|
||||
# Should be redirected to edit page
|
||||
self.assertRedirects(response, reverse('wagtailadmin_pages_edit', args=(self.index_page.id, )))
|
||||
# Should be redirected to explorer
|
||||
self.assertRedirects(response, reverse('wagtailadmin_explore', args=(self.root_page.id, )))
|
||||
|
||||
# Find the page and check it
|
||||
page = Page.objects.get(id=self.index_page.id).specific
|
||||
|
|
|
@ -222,7 +222,12 @@ def create(request, content_type_app_name, content_type_model_name, parent_page_
|
|||
if hasattr(result, 'status_code'):
|
||||
return result
|
||||
|
||||
return redirect('wagtailadmin_pages_edit', page.id)
|
||||
if is_publishing or is_submitting:
|
||||
# we're done here - redirect back to the explorer
|
||||
return redirect('wagtailadmin_explore', page.get_parent().id)
|
||||
else:
|
||||
# Just saving - remain on edit page for further edits
|
||||
return redirect('wagtailadmin_pages_edit', page.id)
|
||||
else:
|
||||
messages.error(request, _("The page could not be created due to validation errors"))
|
||||
edit_handler = edit_handler_class(instance=page, form=form)
|
||||
|
@ -332,7 +337,12 @@ def edit(request, page_id):
|
|||
if hasattr(result, 'status_code'):
|
||||
return result
|
||||
|
||||
return redirect('wagtailadmin_pages_edit', page.id)
|
||||
if is_publishing or is_submitting:
|
||||
# we're done here - redirect back to the explorer
|
||||
return redirect('wagtailadmin_explore', page.get_parent().id)
|
||||
else:
|
||||
# Just saving - remain on edit page for further edits
|
||||
return redirect('wagtailadmin_pages_edit', page.id)
|
||||
else:
|
||||
if page.locked:
|
||||
messages.error(request, _("The page could not be saved as it is locked"))
|
||||
|
|
Ładowanie…
Reference in New Issue