Opened 20 months ago

Closed 20 months ago

Last modified 20 months ago

#33955 closed Bug (fixed)

AttributeError in admindocs ViewDetailView

Reported by: Greg Kaleka Owned by: Mariusz Felisiak
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. Include django.contrib.admindocs in your installed apps
  3. Add the urls to your urlconf: path("admindocs/", include("django.contrib.admindocs.urls"))
  4. Run manage.py migrate and manage.py createsuperuser
  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 (11)

comment:1 by Greg Kaleka, 20 months ago

Description: modified (diff)

comment:2 by Greg Kaleka, 20 months ago

Description: modified (diff)

comment:3 by Greg Kaleka, 20 months ago

Description: modified (diff)

comment:4 by Greg Kaleka, 20 months ago

Description: modified (diff)

comment:5 by Greg Kaleka, 20 months ago

Description: modified (diff)

comment:6 by Mariusz Felisiak, 20 months ago

Cc: Carlton Gibson Alokik Roy added
Has patch: unset
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Thanks for the report.

Regression in 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

comment:7 by Mariusz Felisiak, 20 months ago

Has patch: set
Owner: changed from nobody to Greg Kaleka
Status: newassigned

comment:8 by Carlton Gibson, 20 months ago

Needs tests: set

comment:9 by Mariusz Felisiak, 20 months ago

Needs tests: unset
Owner: changed from Greg Kaleka to Mariusz Felisiak

comment:10 by GitHub <noreply@…>, 20 months ago

Resolution: fixed
Status: assignedclosed

In 974942a7:

Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs."

This reverts commit 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

Thanks Tom Carrick and Greg Kaleka for reports.

comment:11 by Mariusz Felisiak <felisiak.mariusz@…>, 20 months ago

In a108380:

[4.1.x] Fixed #33955, Fixed #33971 -- Reverted "Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs."

This reverts commit 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

Thanks Tom Carrick and Greg Kaleka for reports.
Backport of 974942a75039ba43e618f6a5ff95e08b5d5176fd from main

Note: See TracTickets for help on using tickets.
Back to Top