mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Added AppConfig.setup() to run setup code.
This commit is contained in:
@@ -162,3 +162,8 @@ class AppConfig(object):
|
||||
if module_has_submodule(self.module, MODELS_MODULE_NAME):
|
||||
models_module_name = '%s.%s' % (self.name, MODELS_MODULE_NAME)
|
||||
self.models_module = import_module(models_module_name)
|
||||
|
||||
def setup(self):
|
||||
"""
|
||||
Override this method in subclasses to run setup code.
|
||||
"""
|
||||
|
||||
@@ -135,6 +135,9 @@ class Apps(object):
|
||||
self.clear_cache()
|
||||
self._models_loaded = True
|
||||
|
||||
for app_config in self.get_app_configs():
|
||||
app_config.setup()
|
||||
|
||||
@property
|
||||
def ready(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user