Re: [Django] #33971: admindocs breaks the admin if it appears before the admin in INSTALLED_APPS

3 views
Skip to first unread message

Django

unread,
Sep 1, 2022, 4:29:45 AM9/1/22
to django-...@googlegroups.com
#33971: admindocs breaks the admin if it appears before the admin in INSTALLED_APPS
-----------------------------------+--------------------------------------
Reporter: Tom Carrick | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Description changed by Tom Carrick:

Old 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:
>
> {{{
> #!python
> 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.
> }}}

New description:

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

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:

{{{
#!python
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.
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33971#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 1, 2022, 5:05:51 AM9/1/22
to django-...@googlegroups.com
#33971: admindocs breaks the admin if it appears before the admin in INSTALLED_APPS
-----------------------------------+------------------------------------
Reporter: Tom Carrick | Owner: nobody
Type: Bug | Status: new
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* cc: Carlton Gibson, Alokik Roy (added)
* version: dev => 4.1
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

Thanks for the report! Unfortunately
[https://github.com/django/django/pull/15994#issuecomment-1231512042 the
proposed solution] doesn't fix this for me, so we need to handle it
separately.

Regression in 7f3cfaa12b28d15c0ca78bb692bfd6e59d17bff1.

--
Ticket URL: <https://code.djangoproject.com/ticket/33971#comment:3>

Django

unread,
Sep 1, 2022, 6:53:18 AM9/1/22
to django-...@googlegroups.com
#33971: admindocs breaks the admin if it appears before the admin in INSTALLED_APPS
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned

Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Mariusz Felisiak
* status: new => assigned
* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/16024 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33971#comment:4>

Django

unread,
Sep 1, 2022, 3:09:50 PM9/1/22
to django-...@googlegroups.com
#33971: admindocs breaks the admin if it appears before the admin in INSTALLED_APPS
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"974942a75039ba43e618f6a5ff95e08b5d5176fd" 974942a7]:
{{{
#!CommitTicketReference repository=""
revision="974942a75039ba43e618f6a5ff95e08b5d5176fd"
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.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33971#comment:5>

Django

unread,
Sep 1, 2022, 3:12:17 PM9/1/22
to django-...@googlegroups.com
#33971: admindocs breaks the admin if it appears before the admin in INSTALLED_APPS
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"a1083805acc952419752bc8fd860bfda83af42d2" a108380]:
{{{
#!CommitTicketReference repository=""
revision="a1083805acc952419752bc8fd860bfda83af42d2"
[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
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33971#comment:6>

Django

unread,
Sep 6, 2022, 7:44:35 AM9/6/22
to django-...@googlegroups.com
#33971: admindocs breaks the admin if it appears before the admin in INSTALLED_APPS
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Old description:

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

New description:

--

Comment (by Maxim Danilov):

This patch war unnecessary.
with the same Effect we can remove method ready from class
AdminDocsConfig(AppConfig) from django.contrib.admindocs.apps

For topik starter:
I use many times admindocs in my projects and it was easy solution: to
redefine AdminDocsConfig with empty ready method.

--
Ticket URL: <https://code.djangoproject.com/ticket/33971#comment:7>

Django

unread,
Sep 6, 2022, 7:55:19 AM9/6/22
to django-...@googlegroups.com
#33971: admindocs breaks the admin if it appears before the admin in INSTALLED_APPS
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: contrib.admindocs | Version: 4.1
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:7 Maxim Danilov]:


> This patch war unnecessary.
> with the same Effect we can remove method ready from class
AdminDocsConfig(AppConfig) from django.contrib.admindocs.apps
>
> For topik starter:
> I use many times admindocs in my projects and it was easy solution: to
redefine AdminDocsConfig with empty ready method.

Removing `ready()` was not a proper solution because `admindocs` views
wouldn't work without it as callbacks wouldn't be registered.

--
Ticket URL: <https://code.djangoproject.com/ticket/33971#comment:8>

Reply all
Reply to author
Forward
0 new messages