Opened 2 years ago

Last modified 2 years ago

#33955 closed Bug

AttributeError in admindocs ViewDetailView — at Version 4

Reported by: Greg Kaleka Owned by: nobody
Component: contrib.admindocs Version: 4.1
Severity: Release blocker Keywords:
Cc: Carlton Gibson, Alokik Roy Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Greg Kaleka)

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:

  1. Create a new project with Django 4.1
  2. Run manage.py migrate and manage.py createsuperuser
  3. Include django.contrib.admindocs in your installed apps
  4. Add the urls to your urlconf: path("admindocs/", include("django.contrib.admindocs.urls"))
  5. 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 (4)

comment:1 by Greg Kaleka, 2 years ago

Description: modified (diff)

comment:2 by Greg Kaleka, 2 years ago

Description: modified (diff)

comment:3 by Greg Kaleka, 2 years ago

Description: modified (diff)

comment:4 by Greg Kaleka, 2 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top