I would like to change a name of specific fields in a model:
class Foo(models.Model):
name = models.CharField()
rel = models.ForeignKey(Bar)
should change to:
class Foo(models.Model):
full_name = models.CharField()
odd_relation = models.ForeignKey(Bar)
What’s the easiest way to do this using South?
You can use the
db.rename_columnfunction.The first argument of
db.rename_columnis the table name, so it’s important to remember how Django creates table names:In the case where you have a multi-worded, camel-cased model name, such as ProjectItem, the table name will be
app_projectitem(i.e., an underscore will not be inserted betweenprojectanditemeven though they are camel-cased).