AdminSite docs are incorrect
|Reported by:||bugmenot||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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)), )
# 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."