[Answered ]-Django/South: Migrating different classes to common base class

2👍

You just need to think about the changes South will make to your models, and plan for that.

If Article is an abstract class, South will for the most part disregard it. That is to say all the fields will look as if they are fields directly on the model, pretty much the way you have it now. So, the only changes that will occur are where one model was using name before, it will now have a new title field as well. For this reason, you should leave the name field attached through the schemamigration, then create a datamigration to move its value to the new title field, and finally remove it in another schemamigration.

If Article is a standard base class (multiple-table inheritance), then all your models will get a new OneToOneField to Article. Again, leave all the fields in tact on your models though the schemamigration, then create a datamigration where you will run through each and create an Article instance using the old data on the model and assign that Article instance to the one-to-one field. Then, you can remove the old fields in another schemamigration.

Leave a comment