Ticket #7922: autodiscover.2.diff

File autodiscover.2.diff, 728 bytes (added by Alex, 7 years ago)

Updated, this should work.

  • django/contrib/admin/__init__.py

    diff --git a/django/contrib/admin/__init__.py b/django/contrib/admin/__init__.py
    index 56b64fa..56777d1 100644
    a b def autodiscover(): 
    88    not present. This forces an import on them to register any admin bits they
    99    may want.
    1010    """
     11    import imp
    1112    from django.conf import settings
    1213    for app in settings.INSTALLED_APPS:
    1314        try:
    14             __import__("%s.admin" % app)
     15            imp.find_module('admin', __import__(app, fromlist=[app.split('.')[-1]]).__path__)
    1516        except ImportError:
    16             pass
     17            # There is no admin.py, skip it
     18            continue
     19        __import__('%s.admin' % app)
Back to Top