From d68be0494be8b82365f2a5410c9335e539d8efd6 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 27 Apr 2021 08:40:52 +0200 Subject: [PATCH] Refs 32637 -- Made technical 404 debug page display exception message when URL is resolved. Follow up to 3b8527e32b665df91622649550813bb1ec9a9251. --- django/views/templates/technical_404.html | 2 +- tests/view_tests/tests/test_debug.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/django/views/templates/technical_404.html b/django/views/templates/technical_404.html index aeba2daf9c..c47dae22af 100644 --- a/django/views/templates/technical_404.html +++ b/django/views/templates/technical_404.html @@ -26,7 +26,7 @@

Page not found (404)

- {% if reason %}
{{ reason }}
{% endif %} + {% if reason and resolved %}
{{ reason }}
{% endif %} diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index 28734434f3..9c85ed20fc 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -122,6 +122,11 @@ class DebugViewTests(SimpleTestCase): def test_404(self): response = self.client.get('/raises404/') + self.assertNotContains( + response, + '
',
+            status_code=404,
+        )
         self.assertContains(
             response,
             '

The current path, not-in-urls, didn’t match any ' @@ -133,6 +138,11 @@ class DebugViewTests(SimpleTestCase): def test_404_not_in_urls(self): response = self.client.get('/not-in-urls') self.assertNotContains(response, "Raised by:", status_code=404) + self.assertNotContains( + response, + '

',
+            status_code=404,
+        )
         self.assertContains(response, "Django tried these URL patterns", status_code=404)
         self.assertContains(
             response,
Request Method: