Changes between Version 188 and Version 189 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
07/18/2008 11:35:33 PM (7 years ago)
Author:
brosner
Comment:

added a bit about the admin urls.py change.

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v188 v189  
    686686As of [7967] we have merged newforms-admin into trunk. Here is list of things that have changed:
    687687
     688A lot has changed in this branch. Let's start with the syntax for URLconfs:
     689
     690{{{
     691#!python
     692
     693# OLD:
     694from django.conf.urls.defaults import *
     695
     696urlpatterns = patterns('',
     697    (r'^admin/', include('django.contrib.admin.urls')),
     698)
     699
     700# NEW:
     701from django.conf.urls.defaults import *
     702from django.contrib import admin
     703
     704admin.autodiscover()
     705
     706urlpatterns = patterns('',
     707    (r'^admin/(.*)', admin.site.root),
     708)
     709}}}
     710
     711Note 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
     713We 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
     715Previously, 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
    688718=== Changed Admin.manager option to more flexible hook ===
    689719
Back to Top