Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.7.x] Added a bunch of missing unicode_literals

Refs #22564.
Backport of 12474da from master.
  • Loading branch information...
commit e8f1395f4e65f9d2ffc7a0448980ebaca0b2991a 1 parent 549b658
@claudep claudep authored
View
4 django/db/migrations/autodetector.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import re
import datetime
@@ -380,7 +382,7 @@ def _rel_agnostic_fields_def(fields):
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)
View
2  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
View
2  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
View
2  django/db/migrations/loader.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from importlib import import_module
import os
import sys
View
3  django/db/migrations/migration.py
@@ -1,3 +1,6 @@
+from __future__ import unicode_literals
+
+
class Migration(object):
"""
The base class for all migrations.
View
3  django/db/migrations/operations/base.py
@@ -1,3 +1,6 @@
+from __future__ import unicode_literals
+
+
class Operation(object):
"""
Base class for migration operations.
View
2  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
View
2  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
View
2  django/db/migrations/operations/special.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from .base import Operation
View
2  django/db/migrations/optimizer.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django.db import migrations
View
2  django/db/migrations/questioner.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import importlib
import os
import sys
View
2  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
View
4 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 @@ def render(self, apps):
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(
View
4 django/db/models/fields/related.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from operator import attrgetter
from django.apps import apps
@@ -1817,7 +1819,7 @@ def set_managed(field, model, cls):
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,
Please sign in to comment.
Something went wrong with that request. Please try again.