Add support for registering bootstrapped models from registry
This commit is contained in:
@@ -8,16 +8,19 @@ from django.utils.importlib import import_module
|
||||
|
||||
from .models import App
|
||||
|
||||
###app.set_backup([ModelBackup()])
|
||||
|
||||
for app_name in settings.INSTALLED_APPS:
|
||||
App.register(app_name)
|
||||
try:
|
||||
post_init = import_module('%s.post_init' % app_name)
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
if post_init:
|
||||
for name, value in inspect.getmembers(post_init):
|
||||
if hasattr(value, '__call__') and name.startswith('init'):
|
||||
value()
|
||||
def register_apps():
|
||||
for app_name in settings.INSTALLED_APPS:
|
||||
App.register(app_name)
|
||||
try:
|
||||
post_init = import_module('%s.post_init' % app_name)
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
if post_init:
|
||||
for name, value in inspect.getmembers(post_init):
|
||||
if hasattr(value, '__call__') and name.startswith('init'):
|
||||
value()
|
||||
|
||||
|
||||
register_apps()
|
||||
|
||||
Reference in New Issue
Block a user