diff --git a/django/contrib/admin/__init__.py b/django/contrib/admin/__init__.py
index 704dc58..6f276a6 100644
a
|
b
|
|
1 | 1 | from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL |
2 | 2 | from django.contrib.admin.options import StackedInline, TabularInline |
3 | | from django.contrib.admin.sites import AdminSite, site |
| 3 | from django.contrib.admin.sites import AdminSite |
| 4 | |
| 5 | # This global object represents the default admin site, for the common case. |
| 6 | # You can instantiate AdminSite in your own code to create a custom admin site. |
| 7 | # It is also possible to replace the default site by passing the path to your |
| 8 | # own adminsite class to admin.set_default_site before calling admin.autodiscover(). |
| 9 | |
| 10 | site = AdminSite() |
| 11 | |
| 12 | def set_default_site(import_path): |
| 13 | try: |
| 14 | dot = import_path.rindex('.') |
| 15 | except ValueError: |
| 16 | raise ImproperlyConfigured("%s isn't a adminsite class." % import_path) |
| 17 | module, classname = import_path[:dot], import_path[dot+1:] |
| 18 | try: |
| 19 | mod = __import__(module, {}, {}, ['']) |
| 20 | except ImportError, e: |
| 21 | raise ImproperlyConfigured('Error importing module %s: "%s"' % (module, e)) |
| 22 | try: |
| 23 | site = getattr(mod, classname)() |
| 24 | except AttributeError: |
| 25 | raise ImproperlyConfigured('The module "%s" does not define a "%s" class.' % (module, classname)) |
4 | 26 | |
5 | 27 | def autodiscover(): |
6 | 28 | """ |
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
index 81e43a1..8b8062b 100644
a
|
b
|
class AdminSite(object):
|
402 | 402 | 'app_list': [app_dict] |
403 | 403 | }, context_instance=template.RequestContext(request)) |
404 | 404 | |
405 | | # This global object represents the default admin site, for the common case. |
406 | | # You can instantiate AdminSite in your own code to create a custom admin site. |
407 | | site = AdminSite() |