Fixed #33425 -- Fixed view name for CBVs on technical 404 debug page.
Regression in 0c0b87725b
.
This commit is contained in:
parent
7346c288e3
commit
2a66c102d9
|
@ -545,8 +545,9 @@ def technical_404_response(request, exception):
|
||||||
obj = resolver_match.func
|
obj = resolver_match.func
|
||||||
|
|
||||||
if hasattr(obj, 'view_class'):
|
if hasattr(obj, 'view_class'):
|
||||||
caller = obj.view_class
|
obj = obj.view_class
|
||||||
elif hasattr(obj, '__name__'):
|
|
||||||
|
if hasattr(obj, '__name__'):
|
||||||
caller = obj.__name__
|
caller = obj.__name__
|
||||||
elif hasattr(obj, '__class__') and hasattr(obj.__class__, '__name__'):
|
elif hasattr(obj, '__class__') and hasattr(obj.__class__, '__name__'):
|
||||||
caller = obj.__class__.__name__
|
caller = obj.__class__.__name__
|
||||||
|
|
|
@ -14,3 +14,6 @@ Bugfixes
|
||||||
|
|
||||||
* Fixed a regression in Django 4.0 where ``help_text`` was HTML-escaped in
|
* Fixed a regression in Django 4.0 where ``help_text`` was HTML-escaped in
|
||||||
automatically-generated forms (:ticket:`33419`).
|
automatically-generated forms (:ticket:`33419`).
|
||||||
|
|
||||||
|
* Fixed a regression in Django 4.0 that caused displaying an incorrect name for
|
||||||
|
class-based views on the technical 404 debug page (:ticket:`33425`).
|
||||||
|
|
|
@ -177,7 +177,11 @@ class DebugViewTests(SimpleTestCase):
|
||||||
html=True,
|
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,
|
||||||
|
'<td>view_tests.views.technical404</td>',
|
||||||
|
status_code=404,
|
||||||
|
)
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
'<p>The current path, <code>technical404/</code>, matched the '
|
'<p>The current path, <code>technical404/</code>, matched the '
|
||||||
|
@ -188,8 +192,12 @@ class DebugViewTests(SimpleTestCase):
|
||||||
|
|
||||||
def test_classbased_technical_404(self):
|
def test_classbased_technical_404(self):
|
||||||
response = self.client.get('/classbased404/')
|
response = self.client.get('/classbased404/')
|
||||||
self.assertContains(response, "Raised by:", status_code=404)
|
self.assertContains(
|
||||||
self.assertContains(response, "view_tests.views.Http404View", status_code=404)
|
response,
|
||||||
|
'<th>Raised by:</th><td>view_tests.views.Http404View</td>',
|
||||||
|
status_code=404,
|
||||||
|
html=True,
|
||||||
|
)
|
||||||
|
|
||||||
def test_non_l10ned_numeric_ids(self):
|
def test_non_l10ned_numeric_ids(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue