model_report/report.py
def autodiscover(module_name='reports.py'):
    """
    Auto-discover INSTALLED_APPS report.py modules and fail silently when
    not present. Borrowed form django.contrib.admin
    """

    from importlib import import_module
    from django.utils.module_loading import module_has_submodule

    global reports

    for app in settings.INSTALLED_APPS:
        mod = import_module(app)
        # Attempt to import the app's admin module.
        try:
            before_import_registry = copy.copy(reports)
            import_module('%s.%s' % (app, module_name))
        except:
            # Reset the model registry to the state before the last import as
            # this import will have to reoccur on the next request and this
            # could raise NotRegistered and AlreadyRegistered exceptions
            # (see #8245).
            reports = before_import_registry

            # Decide whether to bubble up this error. If the app just
            # doesn't have an admin module, we can ignore the error
            # attempting to import it, otherwise we want it to bubble up.
            if module_has_submodule(mod, module_name):
                raise

    Auto-discover INSTALLED_APPS report.py modules and fail silently when
    not present. Borrowed form django.contrib.admin
    
Auto-discover INSTALLED_APPS report.py modules and fail silently when
not present.
Auto - discover INSTALLED_APPS report . py modules and fail silently when not present .
def autodiscover(module_name='reports.py'):
    from importlib import import_module
    from django.utils.module_loading import module_has_submodule
    global reports
    for app in settings.INSTALLED_APPS:
        mod = import_module(app)
        try:
            before_import_registry = copy.copy(reports)
            import_module('%s.%s' % (app, module_name))
        except:
            reports = before_import_registry
            if module_has_submodule(mod, module_name):
                raise
def autodiscover ( module_name = 'reports.py' ) : from importlib import import_module from django . utils . module_loading import module_has_submodule global reports for app in settings . INSTALLED_APPS : mod = import_module ( app ) try : before_import_registry = copy . copy ( reports ) import_module ( '%s.%s' % ( app , module_name ) ) except : reports = before_import_registry if module_has_submodule ( mod , module_name ) : raise
Auto-discover INSTALLED_APPS report.py modules and fail silently when
not present.
Auto - discover INSTALLED_APPS report . py modules and fail silently when not present .
"""
    Auto-discover INSTALLED_APPS report.py modules and fail silently when
    not present. Borrowed form django.contrib.admin
    """ # Attempt to import the app's admin module. # Reset the model registry to the state before the last import as # this import will have to reoccur on the next request and this # could raise NotRegistered and AlreadyRegistered exceptions # (see #8245). # Decide whether to bubble up this error. If the app just # doesn't have an admin module, we can ignore the error # attempting to import it, otherwise we want it to bubble up.
module_name