Q:

Couldn't load fixtures with South in Django project

I've Django project which is using South application to handle schema and data migration. In one of my applications I have migration (number 0004) which is responsible for loading data fixtures from json file:
class Migration(DataMigration):

    def forwards(self, orm):
        from django.core.management import call_command
        call_command("loaddata", "dummy_data.json")

In the same project I try to add functionality of 'soft delete' which needs adding one more filed, defined as:
deleted_at = models.DateTimeField(blank=True, null=True)

Based on this change I've added new migration, which has number 0009. After that I start migrate command which give me error:
DatabaseError: Problem installing fixture 'C:/Users/Grzegorz/PycharmProjects/Dummy Project/Dummy\app_subapp\fixtures\dummy_data.json': Could not load app_subapp.DummyData(pk=1): (1054, "Unknown column 'deleted_at' in 'field list'")

It's quite strange, because this error occurs while applying migration 0004 which earlier worked ok and from point of South process in this step filed deleted_at shouldn't and doesn't exists in my database.I've found that moving migration with loading fixture from step 0004 after 0009 resolves problem, but it looks like very dirty and not good approach to resolve this issue.
Do you have any advices how can I resolve this problem and properly handle migrations and fixture loading with South?

A:

I found a Django snippet that does the job!
https://djangosnippets.org/snippets/2897/
It load the data according to the models frozen in the fixture rather the actual model definition in your apps code!
Works perfect for me.

A:

I've found workaround to my problem. Finally I've extracted load fixtures from South migration and delegated this action to Fabric. Now I have separated migration and load initial data, so everything works as I expect.

