Fixed #32637 -- Restored exception message on technical 404 debug page.

Thanks Atul Varma for the report.
This commit is contained in:
Mariusz Felisiak 2021-04-13 09:15:04 +02:00 committed by GitHub
parent b8bb9e1549
commit 3b8527e32b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -20,11 +20,13 @@
#info ol li { font-family: monospace; } #info ol li { font-family: monospace; }
#summary { background: #ffc; } #summary { background: #ffc; }
#explanation { background:#eee; border-bottom: 0px none; } #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> </style>
</head> </head>
<body> <body>
<div id="summary"> <div id="summary">
<h1>Page not found <span>(404)</span></h1> <h1>Page not found <span>(404)</span></h1>
{% if reason %}<pre class="exception_value">{{ reason }}</pre>{% endif %}
<table class="meta"> <table class="meta">
<tr> <tr>
<th>Request Method:</th> <th>Request Method:</th>
@ -66,8 +68,6 @@
{% endif %} {% endif %}
{% if resolved %}matched the last one.{% else %}didnt match any of these.{% endif %} {% if resolved %}matched the last one.{% else %}didnt match any of these.{% endif %}
</p> </p>
{% else %}
<p>{{ reason }}</p>
{% endif %} {% endif %}
</div> </div>

View File

@ -19,3 +19,6 @@ Bugfixes
``QuerySet.values()/values_list()`` after ``QuerySet.union()``, ``QuerySet.values()/values_list()`` after ``QuerySet.union()``,
``intersection()``, and ``difference()`` when it was ordered by an ``intersection()``, and ``difference()`` when it was ordered by an
unannotated field (:ticket:`32627`). unannotated field (:ticket:`32627`).
* Restored, following a regression in Django 3.2, displaying an exception
message on the technical 404 debug page (:ticket:`32637`).

View File

@ -160,6 +160,12 @@ class DebugViewTests(SimpleTestCase):
def test_technical_404(self): def test_technical_404(self):
response = self.client.get('/technical404/') 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, "Raised by:", status_code=404)
self.assertContains(response, "view_tests.views.technical404", status_code=404) self.assertContains(response, "view_tests.views.technical404", status_code=404)
self.assertContains( self.assertContains(