Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#10292 closed (invalid)

AdminSite docs are incorrect

Reported by: bugmenot Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords: AdminSite
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


could use some work. The second paragraph, on subclassing AdminSite, should have a code example, since it is not the same as using the builtin You need to register with myadmin.register() instead of; this is not obvious. A short code snippet would make it obvious.

The first code example, registering the default admin site in the usual way, is next to useless in a section about how to do things outside of the usual way. The second code example is just incorrect:

from django.conf.urls.defaults import *
from myproject.admin import admin_site

urlpatterns = patterns('',
    ('^myadmin/', include(admin_site.urls)),

should be:

from django.conf.urls.defaults import *
from myapp.admin import myadmin

urlpatterns = patterns('',
    ('^myadmin/',    include(myadmin.root)),

since the project itself doesn't have an, and presumably you're not making a whole new app just to administer itself. AdminSite objects have no "urls" attribute, you want to register the "root" attribute. And it would be much clearer if, as mentioned, you included a code snippet before that shows how to subclass AdminSite and register your objects with it.

The last code snippet on the page is also incorrect; "urls" should be "root."

Change History (2)

comment:1 Changed 9 years ago by Alex Gaynor

Resolution: invalid
Status: newclosed

These code examples are completely correct for Django's latest trunk, which is what the online docs are for.

comment:2 Changed 9 years ago by bugmenot

Then they should be marked "Changed in development version." I'm pretty sure what's on the web is labeled 1.0 docs.

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