Commit 525e1e37 authored by Brian Rosner's avatar Brian Rosner
Browse files

Fixed #7922 -- admin.autodiscover() no longer eats ImportErrors for breakfast....

Fixed #7922 -- admin.autodiscover() no longer eats ImportErrors for breakfast. Thanks Jan Rademaker and Alex Gaynor for their work on the ticket.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8174 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent be17a801
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -8,9 +8,12 @@ def autodiscover():
    not present. This forces an import on them to register any admin bits they
    may want.
    """
    import imp
    from django.conf import settings
    for app in settings.INSTALLED_APPS:
        try:
            __import__("%s.admin" % app)
            imp.find_module("admin", app.split("."))
        except ImportError:
            pass
            # there is no admin.py in app, skip it.
            continue
        __import__("%s.admin" % app)