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: