I've been hunting for an answer to this on South's site, Google, and SO, but couldn't find a simple way to do this.
I want to rename a Django model using South. Say you have the following:
class Foo(models.Model):
name = models.CharField()
class FooTwo(models.Model):
name = models.CharField()
foo = models.ForeignKey(Foo)
and you want to convert Foo to Bar, namely
class Bar(models.Model):
name = models.CharField()
class FooTwo(models.Model):
name = models.CharField()
foo = models.ForeignKey(Bar)
To keep it simple, I'm just trying to change the name from Foo
to Bar
, but ignore the foo
member in FooTwo
for now.
What's the easiest way to do this using South?
- I could probably do a data migration, but that seems pretty involved.
- Write a custom migration, e.g.
db.rename_table('city_citystate', 'geo_citystate')
, but I'm not sure how to fix the foreign key in this case. - An easier way that you know?