summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2020-12-22 08:36:56 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-12-22 13:26:27 +0100
commit110001d0bbbabe2a5b57b14a59bd0e4b71bf2712 (patch)
tree17624749a3e063d505ac63fc09847b41ffa38851
parent2a76f4313423a3b91caade4fce71790630ef9152 (diff)
Refs #32285 -- Made AppConfigStub do not call super().__init__().
Calling super().__init__() is unnecessary and enforces the use of various workarounds.
-rw-r--r--django/db/migrations/state.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py
index c8cb704aee..796687853d 100644
--- a/django/db/migrations/state.py
+++ b/django/db/migrations/state.py
@@ -227,15 +227,14 @@ class ProjectState:
class AppConfigStub(AppConfig):
"""Stub of an AppConfig. Only provides a label and a dict of models."""
- # Not used, but required by AppConfig.__init__
- path = ''
-
def __init__(self, label):
- self.label = label
+ self.apps = None
+ self.models = {}
# App-label and app-name are not the same thing, so technically passing
# in the label here is wrong. In practice, migrations don't care about
# the app name, but we need something unique, and the label works fine.
- super().__init__(label, None)
+ self.label = label
+ self.name = label
def import_models(self):
self.models = self.apps.all_models[self.label]
@@ -332,7 +331,6 @@ class StateApps(Apps):
if app_label not in self.app_configs:
self.app_configs[app_label] = AppConfigStub(app_label)
self.app_configs[app_label].apps = self
- self.app_configs[app_label].models = {}
self.app_configs[app_label].models[model._meta.model_name] = model
self.do_pending_operations(model)
self.clear_cache()