2008-07-19 07:54:34 +08:00
|
|
|
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
|
|
|
|
from django.contrib.admin.options import StackedInline, TabularInline
|
|
|
|
from django.contrib.admin.sites import AdminSite, site
|
|
|
|
|
|
|
|
def autodiscover():
|
|
|
|
"""
|
|
|
|
Auto-discover INSTALLED_APPS admin.py modules and fail silently when
|
|
|
|
not present. This forces an import on them to register any admin bits they
|
|
|
|
may want.
|
|
|
|
"""
|
2008-08-02 07:31:20 +08:00
|
|
|
import imp
|
2008-07-19 07:54:34 +08:00
|
|
|
from django.conf import settings
|
|
|
|
for app in settings.INSTALLED_APPS:
|
|
|
|
try:
|
2008-08-02 08:33:21 +08:00
|
|
|
imp.find_module("admin", __import__(app, {}, {}, [app.split(".")[-1]]).__path__)
|
2008-07-19 07:54:34 +08:00
|
|
|
except ImportError:
|
2008-08-02 07:29:25 +08:00
|
|
|
# there is no app admin.py, skip it
|
|
|
|
continue
|
|
|
|
__import__("%s.admin" % app)
|