Added a bunch of missing unicode_literals

Refs #22564.
This commit is contained in:
Claude Paroz 2014-05-05 19:50:51 +02:00
parent df60db0e78
commit 12474dacef
14 changed files with 33 additions and 3 deletions

View File

@ -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)

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from django.db import migrations
from .loader import MigrationLoader
from .recorder import MigrationRecorder

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from django.utils.datastructures import OrderedSet
from django.db.migrations.state import ProjectState

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from importlib import import_module
import os
import sys

View File

@ -1,3 +1,6 @@
from __future__ import unicode_literals
class Migration(object):
"""
The base class for all migrations.

View File

@ -1,3 +1,6 @@
from __future__ import unicode_literals
class Operation(object):
"""
Base class for migration operations.

View File

@ -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 File

@ -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 File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from .base import Operation

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from django.db import migrations

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
import importlib
import os
import sys

View File

@ -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 File

@ -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(

View File

@ -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,