AttributeError in admindocs ViewDetailView
In Django 4.1, the admindocs ViewDetailView
raises an AttributeError
. I'm not clear on why _active
is missing the local_value
attribute when _is_callback
is called.
Reproduction steps:
- Create a new project with Django 4.1
- Include
django.contrib.admindocs
in your installed apps
- Add the urls to your urlconf:
path("admindocs/", include("django.contrib.admindocs.urls"))
- Run
manage.py migrate
and manage.py createsuperuser
- Go to
localhost:8000/admindocs/views/
and click on any view to go to the ViewDetailView
Quick and dirty fix in django/contrib/admindocs/utils.py
:
Code highlighting:
def _is_callback(name, urlresolver=None):
if not hasattr(_active, "local_value"):
_active.local_value = _callback_strs
if urlresolver and not urlresolver._populated:
register_callback(urlresolver, _active.local_value)
return name in _active.local_value
Change History
(11)
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Description: |
modified (diff)
|
Cc: |
Carlton Gibson Alokik Roy added
|
Has patch: |
unset
|
Severity: |
Normal → Release blocker
|
Triage Stage: |
Unreviewed → Accepted
|
Has patch: |
set
|
Owner: |
changed from nobody to Greg Kaleka
|
Status: |
new → assigned
|
Needs tests: |
unset
|
Owner: |
changed from Greg Kaleka to Mariusz Felisiak
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Thanks for the report.
Regression in 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.