#34494: This is questions about customizing AdminSite documents
-----------------------------------------+------------------------
Reporter: jianghan | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
When I was using customizing adminsite and admindoc, I encountered an
error message:
{{{
Reverse for 'app_list' with keyword arguments '{'app_label': 'auth'}' not
found.
}}}
I wrote a custom adminsite according to the document code:
{{{
# admin.py
class MyAdminSite(admin.AdminSite):
site_header = "Django4 Demo"
admin_site = MyAdminSite(name="myadmin")
# urls.py
urlpatterns = [
path('admin/doc/', include('django.contrib.admindocs.urls')),
path("admin/", admin_site.urls),
]
# settings.py
INSTALLED_APPS = [
"django.contrib.admindocs",
# "django.contrib.admin",
"django4demo.apps.MyAdminConfig",
...
]
}}}
At the same time, I also installed admindoc.
After starting, click on "Document" on the page and the above error will
appear.
Upon investigation, it was found that admindoc was using "admin. site"
object from "django. contrib import admin".
And the route registration uses a custom "admin_site" object.
When "resolve(auth)",the route cannot be found, Because there is no under
the custom "admin_site.urls".
When I replaced all "admin_site" object with native "admin.site" object,
the problem was resolved.
Suggest adding relevant comments on the adminsite document to prevent
others from falling into the trap.
thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/34494>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701877f47bdfe-b433740c-d99b-402b-b399-54be5a3b6ac3-000000%40eu-central-1.amazonses.com.