diff options
| author | Brian Rosner <brosner@gmail.com> | 2008-07-09 16:01:33 +0000 |
|---|---|---|
| committer | Brian Rosner <brosner@gmail.com> | 2008-07-09 16:01:33 +0000 |
| commit | 2e72445fce44d95914921448af846ff7a2f70167 (patch) | |
| tree | 130187500560e6b74a4e718cdfe0f4d25573c5cf /docs/admin.txt | |
| parent | 84541cd244638b44ca7f0f1076427470f4128a44 (diff) | |
newforms-admin: Added autodiscover functionality to django.contrib.admin. This makes the admin aware of per-app admin.py modules and does an import on them when explicitly called. Docs show how this is used. Fixed #6003, #6776, #6776.
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7872 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/admin.txt')
| -rw-r--r-- | docs/admin.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/admin.txt b/docs/admin.txt index 996930fc2b..08cafc2450 100644 --- a/docs/admin.txt +++ b/docs/admin.txt @@ -609,11 +609,16 @@ In this example, we register the default ``AdminSite`` instance # urls.py from django.conf.urls.defaults import * from django.contrib import admin + + admin.autodiscover() urlpatterns = patterns('', ('^admin/(.*)', admin.site.root), ) +Above we used ``admin.autodiscover()`` to automatically load the +``INSTALLED_APPS`` admin.py modules. + In this example, we register the ``AdminSite`` instance ``myproject.admin.admin_site`` at the URL ``/myadmin/`` :: @@ -625,6 +630,10 @@ In this example, we register the ``AdminSite`` instance ('^myadmin/(.*)', admin_site.root), ) +There is really no need to use autodiscover when using your own ``AdminSite`` +instance since you will likely be importing all the per-app admin.py modules +in your ``myproject.admin`` module. + Note that the regular expression in the URLpattern *must* group everything in the URL that comes after the URL root -- hence the ``(.*)`` in these examples. |
