Sverre Johansen  committed 6e99ee7

Fixing fixture loading for Django 1.2

LoadInitialDataMigrator monkey patches django.models.get_app, so that
the loaddata management command only loads from the currently migrated
application. This breaks in Django 1.2 because it loads the method

  • Participants
  • Parent commits 2867a83

Comments (0)

Files changed (1)

File south/migration/

 import traceback
 from import call_command
+from import loaddata
 from django.db import models
 from south import exceptions
         # Override Django's get_apps call temporarily to only load from the
         # current app
         old_get_apps = models.get_apps
-        models.get_apps = lambda: [models.get_app(target.app_label())]
+        new_get_apps = lambda: [models.get_app(target.app_label())]
+        models.get_apps = new_get_apps
+        loaddata.get_apps = new_get_apps
             call_command('loaddata', 'initial_data', verbosity=self.verbosity)
             models.get_apps = old_get_apps
+            loaddata.get_apps = old_get_apps
     def migrate_many(self, target, migrations):
         migrator = self._migrator