give a hint when a page is missing (#27031)

This commit is contained in:
Emmanuel Cazenave 2018-10-05 14:11:14 +02:00
parent 58ed3bb9cc
commit 0c7b57fad0
2 changed files with 6 additions and 1 deletions

View File

@ -423,7 +423,7 @@ def page(request):
redirect = Redirect.objects.filter(old_url=url).last()
if redirect:
return HttpResponseRedirect(redirect.page.get_online_url())
raise Http404()
raise Http404("combo: can't find the requested page, you might need to create it.")
return publish_page(request, page)

View File

@ -276,6 +276,11 @@ def test_404(app):
resp = app.get('/foobar/', status=404)
assert 'Custom 404 Text' in resp.text
with override_settings(DEBUG=True):
# check error page provides an hint when debugging
resp = app.get('/foobar/', status=404)
assert "can't find the requested page" in resp.text
def test_style_demo(app, admin_user):
TextCell.objects.all().delete()
Page.objects.all().delete()