Fixed #33848 -- Optimized StateApps.clone().
This commit is contained in:
parent
d4c5d2b52c
commit
f0fa2a3b49
|
@ -680,10 +680,13 @@ class StateApps(Apps):
|
||||||
"""Return a clone of this registry."""
|
"""Return a clone of this registry."""
|
||||||
clone = StateApps([], {})
|
clone = StateApps([], {})
|
||||||
clone.all_models = copy.deepcopy(self.all_models)
|
clone.all_models = copy.deepcopy(self.all_models)
|
||||||
clone.app_configs = copy.deepcopy(self.app_configs)
|
|
||||||
# Set the pointer to the correct app registry.
|
for app_label in self.app_configs:
|
||||||
for app_config in clone.app_configs.values():
|
app_config = AppConfigStub(app_label)
|
||||||
app_config.apps = clone
|
app_config.apps = clone
|
||||||
|
app_config.import_models()
|
||||||
|
clone.app_configs[app_label] = app_config
|
||||||
|
|
||||||
# No need to actually clone them, they'll never change
|
# No need to actually clone them, they'll never change
|
||||||
clone.real_models = self.real_models
|
clone.real_models = self.real_models
|
||||||
return clone
|
return clone
|
||||||
|
|
Loading…
Reference in New Issue