manager: handle unknown page slug in redirect to edit view (#58117)

This commit is contained in:
Valentin Deniaud 2021-10-25 12:24:21 +02:00
parent 74e33cdc80
commit 4fd2151477
2 changed files with 4 additions and 0 deletions

View File

@ -589,6 +589,8 @@ class PageRedirectToEditView(RedirectView):
page = get_page_from_url_parts(page_path.split('/'))
except MissingSubSlug as e:
page = e.page
if not page:
raise Http404()
return reverse('combo-manager-page-view', kwargs={'pk': page.pk})

View File

@ -2635,6 +2635,8 @@ def test_redirect_to_page_edit(app, admin_user):
resp = app.get('/manage/pages/users/xxx/', status=302)
assert resp.location == '/manage/pages/%s/' % page3.pk
resp = app.get('/manage/pages/missing/', status=404)
def test_site_settings(app, admin_user):
app = login(app)