Skip to content

Commit 110001d

Browse files
hramezanifelixxm
authored andcommitted
Refs #32285 -- Made AppConfigStub do not call super().__init__().
Calling super().__init__() is unnecessary and enforces the use of various workarounds.
1 parent 2a76f43 commit 110001d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

django/db/migrations/state.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,14 @@ def __eq__(self, other):
227227

228228
class AppConfigStub(AppConfig):
229229
"""Stub of an AppConfig. Only provides a label and a dict of models."""
230-
# Not used, but required by AppConfig.__init__
231-
path = ''
232-
233230
def __init__(self, label):
234-
self.label = label
231+
self.apps = None
232+
self.models = {}
235233
# App-label and app-name are not the same thing, so technically passing
236234
# in the label here is wrong. In practice, migrations don't care about
237235
# the app name, but we need something unique, and the label works fine.
238-
super().__init__(label, None)
236+
self.label = label
237+
self.name = label
239238

240239
def import_models(self):
241240
self.models = self.apps.all_models[self.label]
@@ -332,7 +331,6 @@ def register_model(self, app_label, model):
332331
if app_label not in self.app_configs:
333332
self.app_configs[app_label] = AppConfigStub(app_label)
334333
self.app_configs[app_label].apps = self
335-
self.app_configs[app_label].models = {}
336334
self.app_configs[app_label].models[model._meta.model_name] = model
337335
self.do_pending_operations(model)
338336
self.clear_cache()

0 commit comments

Comments
 (0)