#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: | no | UI/UX: | no |
Description
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adminsite-objects
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 admin.site. You need to register with myadmin.register() instead of admin.site.register(); 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:
# urls.py from django.conf.urls.defaults import * from myproject.admin import admin_site urlpatterns = patterns('', ('^myadmin/', include(admin_site.urls)), )
should be:
# urls.py 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 admin.py, 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 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
Then they should be marked "Changed in development version." I'm pretty sure what's on the web is labeled 1.0 docs.
These code examples are completely correct for Django's latest trunk, which is what the online docs are for.