mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Makemigration command now works
This commit is contained in:
@@ -54,3 +54,9 @@ class Operation(object):
|
||||
drop the model's table.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def describe(self):
|
||||
"""
|
||||
Outputs a brief summary of what the action does.
|
||||
"""
|
||||
return "%s: %s" % (self.__class__.__name__, self._constructor_args)
|
||||
|
||||
@@ -23,6 +23,9 @@ class AddField(Operation):
|
||||
from_model = from_state.render().get_model(app_label, self.model_name)
|
||||
schema_editor.remove_field(from_model, from_model._meta.get_field_by_name(self.name)[0])
|
||||
|
||||
def describe(self):
|
||||
return "Add field %s to %s" % (self.name, self.model_name)
|
||||
|
||||
|
||||
class RemoveField(Operation):
|
||||
"""
|
||||
@@ -48,3 +51,6 @@ class RemoveField(Operation):
|
||||
from_model = from_state.render().get_model(app_label, self.model_name)
|
||||
to_model = to_state.render().get_model(app_label, self.model_name)
|
||||
schema_editor.add_field(from_model, to_model._meta.get_field_by_name(self.name)[0])
|
||||
|
||||
def describe(self):
|
||||
return "Remove field %s from %s" % (self.name, self.model_name)
|
||||
|
||||
@@ -25,6 +25,9 @@ class CreateModel(Operation):
|
||||
app_cache = from_state.render()
|
||||
schema_editor.delete_model(app_cache.get_model(app, self.name))
|
||||
|
||||
def describe(self):
|
||||
return "Create model %s" % (self.name, )
|
||||
|
||||
|
||||
class DeleteModel(Operation):
|
||||
"""
|
||||
@@ -44,3 +47,6 @@ class DeleteModel(Operation):
|
||||
def database_backwards(self, app_label, schema_editor, from_state, to_state):
|
||||
app_cache = to_state.render()
|
||||
schema_editor.create_model(app_cache.get_model(app_label, self.name))
|
||||
|
||||
def describe(self):
|
||||
return "Delete model %s" % (self.name, )
|
||||
|
||||
Reference in New Issue
Block a user