mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
Autodetect fields, have migrate actually work
This commit is contained in:
@@ -6,13 +6,13 @@ class AddField(Operation):
|
||||
Adds a field to a model.
|
||||
"""
|
||||
|
||||
def __init__(self, model_name, name, instance):
|
||||
def __init__(self, model_name, name, field):
|
||||
self.model_name = model_name
|
||||
self.name = name
|
||||
self.instance = instance
|
||||
self.field = field
|
||||
|
||||
def state_forwards(self, app_label, state):
|
||||
state.models[app_label, self.model_name.lower()].fields.append((self.name, self.instance))
|
||||
state.models[app_label, self.model_name.lower()].fields.append((self.name, self.field))
|
||||
|
||||
def database_forwards(self, app_label, schema_editor, from_state, to_state):
|
||||
from_model = from_state.render().get_model(app_label, self.model_name)
|
||||
|
||||
Reference in New Issue
Block a user