summaryrefslogtreecommitdiff
path: root/django/apps/registry.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2016-09-30 21:35:04 +0200
committerTim Graham <timograham@gmail.com>2016-10-28 18:43:45 -0400
commitfd748c42a96213ebc0a18cc661ecb1abaadabcca (patch)
tree328af4da7514338c52b78a78b6c398b1758e861d /django/apps/registry.py
parentefcb7e1ebf2b852a442d00a31634438359eb4039 (diff)
Simplified AppConfig.import_models().
Since AppConfig now has a reference to its parent Apps registry, it can look up the models there instead of receiving them in argument.
Diffstat (limited to 'django/apps/registry.py')
-rw-r--r--django/apps/registry.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/django/apps/registry.py b/django/apps/registry.py
index 91d6d5ccef..adf6cbf753 100644
--- a/django/apps/registry.py
+++ b/django/apps/registry.py
@@ -77,7 +77,7 @@ class Apps(object):
if self.app_configs:
raise RuntimeError("populate() isn't reentrant")
- # Load app configs and app modules.
+ # Phase 1: initialize app configs and import app modules.
for entry in installed_apps:
if isinstance(entry, AppConfig):
app_config = entry
@@ -103,15 +103,15 @@ class Apps(object):
self.apps_ready = True
- # Load models.
+ # Phase 2: import models modules.
for app_config in self.app_configs.values():
- all_models = self.all_models[app_config.label]
- app_config.import_models(all_models)
+ app_config.import_models()
self.clear_cache()
self.models_ready = True
+ # Phase 3: run ready() methods of app configs.
for app_config in self.get_app_configs():
app_config.ready()