Skip to content

Commit

Permalink
add module_name in autodiscover
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpex committed Mar 27, 2016
1 parent 00b1d98 commit 6d2fa61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Binary file modified example/test_project/model_report.db
Binary file not shown.
6 changes: 3 additions & 3 deletions model_report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
OrderedDict = dict # pyflakes:ignore


def autodiscover():
def autodiscover(module_name='reports.py'):
"""
Auto-discover INSTALLED_APPS report.py modules and fail silently when
not present. Borrowed form django.contrib.admin
Expand All @@ -53,7 +53,7 @@ def autodiscover():
# Attempt to import the app's admin module.
try:
before_import_registry = copy.copy(reports)
import_module('%s.reports' % app)
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
Expand All @@ -64,7 +64,7 @@ def autodiscover():
# 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, 'reports'):
if module_has_submodule(mod, module_name):
raise


Expand Down

0 comments on commit 6d2fa61

Please sign in to comment.