Move models between Django (1.8) apps with required ForeignKey references

Migrating a model between apps. The short answer is, don’t do it!! But that answer rarely works in the real world of living projects and production databases. Therefore, I have created a sample GitHub repo to demonstrate this rather complicated process. I am using MySQL. (No, those aren’t my real credentials). The Problem The example … Read more

How to move a model between two Django apps (Django 1.7)

This can be done fairly easily using migrations.SeparateDatabaseAndState. Basically, we use a database operation to rename the table concurrently with two state operations to remove the model from one app’s history and create it in another’s. Remove from old app python manage.py makemigrations old_app –empty In the migration: class Migration(migrations.Migration): dependencies = [] database_operations = … Read more