From 3b8527e32b665df91622649550813bb1ec9a9251 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 13 Apr 2021 09:15:04 +0200 Subject: [PATCH] Fixed #32637 -- Restored exception message on technical 404 debug page. Thanks Atul Varma for the report. --- django/views/templates/technical_404.html | 4 ++-- docs/releases/3.2.1.txt | 3 +++ tests/view_tests/tests/test_debug.py | 6 ++++++ 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; }

Page not found (404)

+ {% if reason %}
{{ reason }}
{% endif %} @@ -66,8 +68,6 @@ {% endif %} {% if resolved %}matched the last one.{% else %}didn’t match any of these.{% endif %}

- {% else %} -

{{ reason }}

{% endif %} 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, + '
Testing technical 404.
', + 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(
Request Method: