diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py index 83e0b13f33..141e0ae1f3 100644 --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import re import datetime @@ -380,7 +382,7 @@ class MigrationAutodetector(object): def add_to_migration(self, app_label, operation, new=False): migrations = self.migrations.setdefault(app_label, []) if not migrations or new: - subclass = type("Migration", (Migration,), {"operations": [], "dependencies": []}) + subclass = type(str("Migration"), (Migration,), {"operations": [], "dependencies": []}) instance = subclass("auto_%i" % (len(migrations) + 1), app_label) migrations.append(instance) migrations[-1].operations.append(operation) diff --git a/django/db/migrations/executor.py b/django/db/migrations/executor.py index 147aa550ae..04d2b778f5 100644 --- a/django/db/migrations/executor.py +++ b/django/db/migrations/executor.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from django.db import migrations from .loader import MigrationLoader from .recorder import MigrationRecorder diff --git a/django/db/migrations/graph.py b/django/db/migrations/graph.py index af6a31bda8..8e034f2bd0 100644 --- a/django/db/migrations/graph.py +++ b/django/db/migrations/graph.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from django.utils.datastructures import OrderedSet from django.db.migrations.state import ProjectState diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py index 48166a1bdb..719f398771 100644 --- a/django/db/migrations/loader.py +++ b/django/db/migrations/loader.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from importlib import import_module import os import sys diff --git a/django/db/migrations/migration.py b/django/db/migrations/migration.py index 4ebaa431ba..3d7f47f0fa 100644 --- a/django/db/migrations/migration.py +++ b/django/db/migrations/migration.py @@ -1,3 +1,6 @@ +from __future__ import unicode_literals + + class Migration(object): """ The base class for all migrations. diff --git a/django/db/migrations/operations/base.py b/django/db/migrations/operations/base.py index 59c8b0960b..7e93fb7836 100644 --- a/django/db/migrations/operations/base.py +++ b/django/db/migrations/operations/base.py @@ -1,3 +1,6 @@ +from __future__ import unicode_literals + + class Operation(object): """ Base class for migration operations. diff --git a/django/db/migrations/operations/fields.py b/django/db/migrations/operations/fields.py index ebb0ab2c64..fbffa19961 100644 --- a/django/db/migrations/operations/fields.py +++ b/django/db/migrations/operations/fields.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from django.db import router from django.db.models.fields import NOT_PROVIDED from django.utils import six diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py index 7253b29fad..76ec83c40e 100644 --- a/django/db/migrations/operations/models.py +++ b/django/db/migrations/operations/models.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from django.db import models, router from django.db.models.options import normalize_together from django.db.migrations.state import ModelState diff --git a/django/db/migrations/operations/special.py b/django/db/migrations/operations/special.py index f87585f0db..a80096cb32 100644 --- a/django/db/migrations/operations/special.py +++ b/django/db/migrations/operations/special.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from .base import Operation diff --git a/django/db/migrations/optimizer.py b/django/db/migrations/optimizer.py index ad221d2285..e81d0f92fa 100644 --- a/django/db/migrations/optimizer.py +++ b/django/db/migrations/optimizer.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from django.db import migrations diff --git a/django/db/migrations/questioner.py b/django/db/migrations/questioner.py index 3f8cefeecd..4619bd616a 100644 --- a/django/db/migrations/questioner.py +++ b/django/db/migrations/questioner.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import importlib import os import sys diff --git a/django/db/migrations/recorder.py b/django/db/migrations/recorder.py index 4c85ebd6d1..57ceb8da03 100644 --- a/django/db/migrations/recorder.py +++ b/django/db/migrations/recorder.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from django.apps.registry import Apps from django.db import models from django.utils.encoding import python_2_unicode_compatible diff --git a/django/db/migrations/state.py b/django/db/migrations/state.py index a2e44d26d3..92c7a52ef4 100644 --- a/django/db/migrations/state.py +++ b/django/db/migrations/state.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from django.apps import AppConfig from django.apps.registry import Apps, apps as global_apps from django.db import models @@ -244,7 +246,7 @@ class ModelState(object): meta_contents.update(self.options) if "unique_together" in meta_contents: meta_contents["unique_together"] = list(meta_contents["unique_together"]) - meta = type("Meta", tuple(), meta_contents) + meta = type(str("Meta"), tuple(), meta_contents) # Then, work out our bases try: bases = tuple( diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 092898aedb..bad457f571 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from operator import attrgetter from django.apps import apps @@ -1831,7 +1833,7 @@ def create_many_to_many_intermediary_model(field, klass): else: from_ = klass._meta.model_name to = to.lower() - meta = type('Meta', (object,), { + meta = type(str('Meta'), (object,), { 'db_table': field._get_m2m_db_table(klass._meta), 'managed': managed, 'auto_created': klass,