Opened 2 years ago

Last modified 2 years ago

#33971 closed Bug

admindocs doesn't work if it appears before the admin in INSTALLED_APPS — at Initial Version

Reported by: Tom Carrick 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

This seems to be different from https://code.djangoproject.com/ticket/32150 as it's about the ordering of installed apps, not urls.

It also seems to be a regression: this works fine in 4.0 but not in 4.1 / main.

This does not work, but if you reverse the order it works fine:

INSTALLED_APPS = [
    ...
    "django.contrib.admindocs",
    "django.contrib.admin",
]

With the error:

Environment:


Request Method: GET
Request URL: http://localhost:8000/admin/

Django Version: 4.2.dev20220901073912
Python Version: 3.10.0
Installed Applications:
['django.contrib.admindocs',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File "/Users/tom/work/oss/django/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/Users/tom/work/oss/django/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/tom/work/oss/django/django/contrib/admin/sites.py", line 261, in wrapper
    return self.admin_view(view, cacheable)(*args, **kwargs)
  File "/Users/tom/work/oss/django/django/utils/decorators.py", line 133, in _wrapper_view
    response = view_func(request, *args, **kwargs)
  File "/Users/tom/work/oss/django/django/views/decorators/cache.py", line 62, in _wrapper_view_func
    response = view_func(request, *args, **kwargs)
  File "/Users/tom/work/oss/django/django/contrib/admin/sites.py", line 242, in inner
    return view(request, *args, **kwargs)
  File "/Users/tom/work/oss/django/django/contrib/admin/sites.py", line 552, in index
    app_list = self.get_app_list(request)
  File "/Users/tom/work/oss/django/django/contrib/admin/sites.py", line 536, in get_app_list
    app_dict = self._build_app_dict(request, app_label)
  File "/Users/tom/work/oss/django/django/contrib/admin/sites.py", line 520, in _build_app_dict
    "app_url": reverse(
  File "/Users/tom/work/oss/django/django/urls/base.py", line 88, in reverse
    return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
  File "/Users/tom/work/oss/django/django/urls/resolvers.py", line 803, in _reverse_with_prefix
    raise NoReverseMatch(msg)

Exception Type: NoReverseMatch at /admin/
Exception Value: Reverse for 'app_list' not found. 'app_list' is not a valid view function or pattern name.

Change History (0)

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