0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Raise 404 if failing to find specified page or task for previewing during moderation

This commit is contained in:
jacobtoppm 2020-04-09 16:48:01 +01:00 committed by Matt Westcott
parent dec7f8ed46
commit b2fba99817

View File

@ -1274,8 +1274,8 @@ def preview_revision_for_task(request, page_id, task_id):
"""Preview the revision linked to the in-progress TaskState of a specified Task. This enables pages in moderation
to be edited and new TaskStates linked to the new revisions created, with preview links remaining valid"""
page = Page.objects.get(id=page_id)
task = Task.objects.get(id=task_id).specific
page = get_object_or_404(Page, id=page_id)
task = get_object_or_404(Task, id=task_id).specific
try:
task_state = TaskState.objects.get(page_revision__page=page, task=task, status=TaskState.STATUS_IN_PROGRESS)
except TaskState.DoesNotExist: