summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-04-13 09:15:04 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-04-13 09:15:25 +0200
commitd6314c4c2ef647efe0d12450214fc5b4a4055290 (patch)
treea6d3de9a2e8f7de929a84901590e5272fdd4a800
parentb245845575154905701a71d34a4d0c4d21f2f6b3 (diff)
[3.2.x] Fixed #32637 -- Restored exception message on technical 404 debug page.
Thanks Atul Varma for the report. Backport of 3b8527e32b665df91622649550813bb1ec9a9251 from main
-rw-r--r--django/views/templates/technical_404.html4
-rw-r--r--docs/releases/3.2.1.txt3
-rw-r--r--tests/view_tests/tests/test_debug.py6
3 files changed, 11 insertions, 2 deletions
diff --git a/django/views/templates/technical_404.html b/django/views/templates/technical_404.html
index 077bb20964..aeba2daf9c 100644
--- a/django/views/templates/technical_404.html
+++ b/django/views/templates/technical_404.html
@@ -20,11 +20,13 @@
#info ol li { font-family: monospace; }
#summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; }
+ pre.exception_value { font-family: sans-serif; color: #575757; font-size: 1.5em; margin: 10px 0 10px 0; }
</style>
</head>
<body>
<div id="summary">
<h1>Page not found <span>(404)</span></h1>
+ {% if reason %}<pre class="exception_value">{{ reason }}</pre>{% endif %}
<table class="meta">
<tr>
<th>Request Method:</th>
@@ -66,8 +68,6 @@
{% endif %}
{% if resolved %}matched the last one.{% else %}didn’t match any of these.{% endif %}
</p>
- {% else %}
- <p>{{ reason }}</p>
{% endif %}
</div>
diff --git a/docs/releases/3.2.1.txt b/docs/releases/3.2.1.txt
index 2a7dda13ab..376efb0211 100644
--- a/docs/releases/3.2.1.txt
+++ b/docs/releases/3.2.1.txt
@@ -19,3 +19,6 @@ Bugfixes
``QuerySet.values()/values_list()`` after ``QuerySet.union()``,
``intersection()``, and ``difference()`` when it was ordered by an
unannotated field (:ticket:`32627`).
+
+* Restored, following a regression in Django 3.2, displaying an exception
+ message on the technical 404 debug page (:ticket:`32637`).
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 35a44451f2..28734434f3 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -160,6 +160,12 @@ class DebugViewTests(SimpleTestCase):
def test_technical_404(self):
response = self.client.get('/technical404/')
+ self.assertContains(
+ response,
+ '<pre class="exception_value">Testing technical 404.</pre>',
+ status_code=404,
+ html=True,
+ )
self.assertContains(response, "Raised by:", status_code=404)
self.assertContains(response, "view_tests.views.technical404", status_code=404)
self.assertContains(