mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[1.7.x] Added a bunch of missing unicode_literals
Refs #22564.
Backport of 12474dace from master.
			
			
This commit is contained in:
		| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| import re | import re | ||||||
| import datetime | import datetime | ||||||
|  |  | ||||||
| @@ -380,7 +382,7 @@ class MigrationAutodetector(object): | |||||||
|     def add_to_migration(self, app_label, operation, new=False): |     def add_to_migration(self, app_label, operation, new=False): | ||||||
|         migrations = self.migrations.setdefault(app_label, []) |         migrations = self.migrations.setdefault(app_label, []) | ||||||
|         if not migrations or new: |         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) |             instance = subclass("auto_%i" % (len(migrations) + 1), app_label) | ||||||
|             migrations.append(instance) |             migrations.append(instance) | ||||||
|         migrations[-1].operations.append(operation) |         migrations[-1].operations.append(operation) | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from django.db import migrations | from django.db import migrations | ||||||
| from .loader import MigrationLoader | from .loader import MigrationLoader | ||||||
| from .recorder import MigrationRecorder | from .recorder import MigrationRecorder | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from django.utils.datastructures import OrderedSet | from django.utils.datastructures import OrderedSet | ||||||
| from django.db.migrations.state import ProjectState | from django.db.migrations.state import ProjectState | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from importlib import import_module | from importlib import import_module | ||||||
| import os | import os | ||||||
| import sys | import sys | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
|  |  | ||||||
| class Migration(object): | class Migration(object): | ||||||
|     """ |     """ | ||||||
|     The base class for all migrations. |     The base class for all migrations. | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
|  |  | ||||||
| class Operation(object): | class Operation(object): | ||||||
|     """ |     """ | ||||||
|     Base class for migration operations. |     Base class for migration operations. | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from django.db import router | from django.db import router | ||||||
| from django.db.models.fields import NOT_PROVIDED | from django.db.models.fields import NOT_PROVIDED | ||||||
| from django.utils import six | from django.utils import six | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from django.db import models, router | from django.db import models, router | ||||||
| from django.db.models.options import normalize_together | from django.db.models.options import normalize_together | ||||||
| from django.db.migrations.state import ModelState | from django.db.migrations.state import ModelState | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from .base import Operation | from .base import Operation | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from django.db import migrations | from django.db import migrations | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| import importlib | import importlib | ||||||
| import os | import os | ||||||
| import sys | import sys | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from django.apps.registry import Apps | from django.apps.registry import Apps | ||||||
| from django.db import models | from django.db import models | ||||||
| from django.utils.encoding import python_2_unicode_compatible | from django.utils.encoding import python_2_unicode_compatible | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from django.apps import AppConfig | from django.apps import AppConfig | ||||||
| from django.apps.registry import Apps, apps as global_apps | from django.apps.registry import Apps, apps as global_apps | ||||||
| from django.db import models | from django.db import models | ||||||
| @@ -244,7 +246,7 @@ class ModelState(object): | |||||||
|         meta_contents.update(self.options) |         meta_contents.update(self.options) | ||||||
|         if "unique_together" in meta_contents: |         if "unique_together" in meta_contents: | ||||||
|             meta_contents["unique_together"] = list(meta_contents["unique_together"]) |             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 |         # Then, work out our bases | ||||||
|         try: |         try: | ||||||
|             bases = tuple( |             bases = tuple( | ||||||
|   | |||||||
| @@ -1,3 +1,5 @@ | |||||||
|  | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from operator import attrgetter | from operator import attrgetter | ||||||
|  |  | ||||||
| from django.apps import apps | from django.apps import apps | ||||||
| @@ -1817,7 +1819,7 @@ def create_many_to_many_intermediary_model(field, klass): | |||||||
|     else: |     else: | ||||||
|         from_ = klass._meta.model_name |         from_ = klass._meta.model_name | ||||||
|         to = to.lower() |         to = to.lower() | ||||||
|     meta = type('Meta', (object,), { |     meta = type(str('Meta'), (object,), { | ||||||
|         'db_table': field._get_m2m_db_table(klass._meta), |         'db_table': field._get_m2m_db_table(klass._meta), | ||||||
|         'managed': managed, |         'managed': managed, | ||||||
|         'auto_created': klass, |         'auto_created': klass, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user