summaryrefslogtreecommitdiff
path: root/django/views/debug.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-07-07 16:23:54 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-09-07 06:54:19 +0200
commit11ebc6479ffda87376b60c9475d33d8120f86368 (patch)
treeccc77bccff2f90a3b16b887f975e08cbdbcf5419 /django/views/debug.py
parent83dea65ed649b5e80111017cd5c476c636872b2d (diff)
Fixed #31791 -- Made technical 404 debug page display the tried URL patterns for Http404.
Diffstat (limited to 'django/views/debug.py')
-rw-r--r--django/views/debug.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/views/debug.py b/django/views/debug.py
index e45ef01ace..7a89f7bd15 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -481,8 +481,10 @@ def technical_404_response(request, exception):
try:
tried = exception.args[0]['tried']
except (IndexError, TypeError, KeyError):
- tried = []
+ resolved = True
+ tried = request.resolver_match.tried if request.resolver_match else None
else:
+ resolved = False
if (not tried or ( # empty URLconf
request.path == '/' and
len(tried) == 1 and # default URLconf
@@ -520,6 +522,7 @@ def technical_404_response(request, exception):
'root_urlconf': settings.ROOT_URLCONF,
'request_path': error_url,
'urlpatterns': tried,
+ 'resolved': resolved,
'reason': str(exception),
'request': request,
'settings': reporter_filter.get_safe_settings(),