diff --git a/django/contrib/admin/__init__.py b/django/contrib/admin/__init__.py
index 704dc58..8367501 100644
a
|
b
|
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
|
2 | 2 | from django.contrib.admin.options import StackedInline, TabularInline |
3 | 3 | from django.contrib.admin.sites import AdminSite, site |
4 | 4 | |
| 5 | valid_apps_admin = [] |
| 6 | |
5 | 7 | def autodiscover(): |
6 | 8 | """ |
7 | 9 | Auto-discover INSTALLED_APPS admin.py modules and fail silently when |
… |
… |
def autodiscover():
|
10 | 12 | """ |
11 | 13 | import imp |
12 | 14 | from django.conf import settings |
| 15 | |
13 | 16 | for app in settings.INSTALLED_APPS: |
14 | | try: |
15 | | imp.find_module("admin", __import__(app, {}, {}, [app.split(".")[-1]]).__path__) |
16 | | except ImportError: |
17 | | # there is no app admin.py, skip it |
18 | | continue |
19 | | __import__("%s.admin" % app) |
| 17 | |
| 18 | if app not in valid_apps_admin: |
| 19 | |
| 20 | try: |
| 21 | imp.find_module("admin", __import__(app, {}, {}, [app.split(".")[-1]]).__path__) |
| 22 | except ImportError: |
| 23 | # there is no app admin.py, skip it |
| 24 | continue |
| 25 | try: |
| 26 | __import__("%s.admin" % app) |
| 27 | except: |
| 28 | raise |
| 29 | else: |
| 30 | valid_apps_admin.append(app) |