Django 1.7 introduced Migrations so now you don’t even need to install extra package to manage your migrations.
To rename your model you need to create empty migration first:
$ manage.py makemigrations <app_name> --empty
Then you need to edit your migration’s code like this:
from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('yourapp', 'XXXX_your_previous_migration'), ] operations = [ migrations.RenameField( model_name="Foo", old_name="name", new_name="full_name" ), migrations.RenameField( model_name="Foo", old_name="rel", new_name="odd_relation" ), ]
And after that you need to run:
$ manage.py migrate <app_name>
Leave an answer