Commits

Andrew Godwin committed b3b4970

Fixed #1312: Django 1.6 incompatabilities

Comments (0)

Files changed (4)

south/management/commands/datamigration.py

 
 
 MIGRATION_TEMPLATE = """# -*- coding: utf-8 -*-
-import datetime
+from south.utils import datetime_utils as datetime
 from south.db import db
 from south.v2 import DataMigration
 from django.db import models

south/management/commands/schemamigration.py

 
 
 MIGRATION_TEMPLATE = """# -*- coding: utf-8 -*-
-import datetime
+from south.utils import datetime_utils as datetime
 from south.db import db
 from south.v2 import SchemaMigration
 from django.db import models

south/test_shim.py

+"""
+This file is needed as 1.6 only finds tests in files labelled test_*,
+and ignores tests/__init__.py.
+"""
+
+from south.tests import *
     
     def gf(self, field_name):
         "Gets a field by absolute reference."
-        return ask_for_it_by_name(field_name)
+        field = ask_for_it_by_name(field_name)
+        field.model = FakeModel
+        return field
 
 class SchemaMigration(BaseMigration):
     pass
 class DataMigration(BaseMigration):
     # Data migrations shouldn't be dry-run
     no_dry_run = True
+
+class FakeModel(object):
+    "Fake model so error messages on fields don't explode"
+    pass