We have a legacy codebase that has a model A and B that both inherit from non-abstract model C. The codebase is old enough that abstract models were not a thing yet in Django, is my understanding.
Needless to say, this is causing problems and we would like to migrate C into being an abstract model. However, there doesn't appear to be a clean way to do so. Complications also include the fact that C includes a 'parent' field that points to other C objects (this should become A having a parent field that points to other As, and B having a fk pointing to A objects), as well as other seperate models also having FK to A and B, which sems to be implemented as FKs towards C instead for some odd reason.
Right now I'm trying to create each of the C fields on A and B as 'temp_<fieldname>' fields, using RunPython to copy the data over into the temp fields, delete the C_ptr field, and then rename the fields to their proper names with RenameField, and finally delete the C model.
Right now it's complaining that it cannot delete C_ptr because there's things relying on it, but I don't see how I can change that, because all the models 'relying' on it, aren't even pointed at C at all- they're all pointed at A and B.
What's the proper way to migrate this without losing data?