1
0
mirror of https://github.com/django/django.git synced 2025-10-29 00:26:07 +00:00

Add an Executor for end-to-end running

This commit is contained in:
Andrew Godwin
2013-05-30 18:08:58 +01:00
parent 7f9a0b7061
commit e6f7f4533c
7 changed files with 188 additions and 11 deletions

View File

@@ -16,13 +16,13 @@ class AddField(Operation):
def database_forwards(self, app_label, schema_editor, from_state, to_state):
app_cache = to_state.render()
model = app_cache.get_model(app_label, self.name)
schema_editor.add_field(model, model._meta.get_field_by_name(self.name))
model = app_cache.get_model(app_label, self.model_name)
schema_editor.add_field(model, model._meta.get_field_by_name(self.name)[0])
def database_backwards(self, app_label, schema_editor, from_state, to_state):
app_cache = from_state.render()
model = app_cache.get_model(app_label, self.name)
schema_editor.remove_field(model, model._meta.get_field_by_name(self.name))
model = app_cache.get_model(app_label, self.model_name)
schema_editor.remove_field(model, model._meta.get_field_by_name(self.name)[0])
class RemoveField(Operation):
@@ -43,10 +43,10 @@ class RemoveField(Operation):
def database_forwards(self, app_label, schema_editor, from_state, to_state):
app_cache = from_state.render()
model = app_cache.get_model(app_label, self.name)
schema_editor.remove_field(model, model._meta.get_field_by_name(self.name))
model = app_cache.get_model(app_label, self.model_name)
schema_editor.remove_field(model, model._meta.get_field_by_name(self.name)[0])
def database_backwards(self, app_label, schema_editor, from_state, to_state):
app_cache = to_state.render()
model = app_cache.get_model(app_label, self.name)
schema_editor.add_field(model, model._meta.get_field_by_name(self.name))
model = app_cache.get_model(app_label, self.model_name)
schema_editor.add_field(model, model._meta.get_field_by_name(self.name)[0])