| 688 | A lot has changed in this branch. Let's start with the syntax for URLconfs: |
| 689 | |
| 690 | {{{ |
| 691 | #!python |
| 692 | |
| 693 | # OLD: |
| 694 | from django.conf.urls.defaults import * |
| 695 | |
| 696 | urlpatterns = patterns('', |
| 697 | (r'^admin/', include('django.contrib.admin.urls')), |
| 698 | ) |
| 699 | |
| 700 | # NEW: |
| 701 | from django.conf.urls.defaults import * |
| 702 | from django.contrib import admin |
| 703 | |
| 704 | admin.autodiscover() |
| 705 | |
| 706 | urlpatterns = patterns('', |
| 707 | (r'^admin/(.*)', admin.site.root), |
| 708 | ) |
| 709 | }}} |
| 710 | |
| 711 | Note that, in this above URLconf example, we're dealing with the object {{{django.contrib.admin.site}}}. This is an instance of {{{django.contrib.admin.AdminSite}}}, which is a class that lets you specify admin-site functionality. The object {{{django.contrib.admin.site}}} is a default {{{AdminSite}}} instance that is created for you automatically, but you can also create other instances as you see fit. |
| 712 | |
| 713 | We use the {{{admin.autodiscover()}}} call above to force the import of the {{{admin.py}}} module of each {{{INSTALLED_APPS}}} entry. This won't be needed if you use your own {{{AdminSite}}} instance since you will likely be importing those modules explicily in a project-level {{{admin.py}}}. This was added in [7872]. |
| 714 | |
| 715 | Previously, there was one "global" version of the admin site, which used all models that contained a {{{class Admin}}}. This new scheme allows for much more fine-grained control over your admin sites, allowing you to have multiple admin sites in the same Django instance. |
| 716 | |
| 717 | |