Skip to content

Commit 0134e64

Browse files
committed
check for allow migrate
1 parent b837903 commit 0134e64

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

django_add_default_value/add_default_value.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def database_forwards(self, app_label, schema_editor, from_state, to_state):
7272
if not self.is_supported_vendor(schema_editor.connection.vendor):
7373
return
7474

75+
to_model = to_state.apps.get_model(app_label, self.model_name)
76+
if not self.allow_migrate_model(schema_editor.connection.alias, to_model):
77+
return
78+
7579
self.initialize_vendor_state(schema_editor)
7680

7781
to_model = to_state.apps.get_model(app_label, self.model_name)
@@ -107,6 +111,10 @@ def database_backwards(self, app_label, schema_editor, from_state, to_state):
107111
if not self.is_supported_vendor(schema_editor.connection.vendor):
108112
return
109113

114+
to_model = to_state.apps.get_model(app_label, self.model_name)
115+
if not self.allow_migrate_model(schema_editor.connection.alias, to_model):
116+
return
117+
110118
self.initialize_vendor_state(schema_editor)
111119

112120
to_model = to_state.apps.get_model(app_label, self.model_name)

0 commit comments

Comments
 (0)