mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[py3] Replaced unicode/str by six.text_type/bytes.
This commit is contained in:
@@ -3,6 +3,7 @@ from optparse import make_option
|
||||
|
||||
from django.core.management.base import NoArgsCommand, CommandError
|
||||
from django.db import connections, DEFAULT_DB_ALIAS
|
||||
from django.utils import six
|
||||
|
||||
class Command(NoArgsCommand):
|
||||
help = "Introspects the database tables in the given database and outputs a Django model module."
|
||||
@@ -115,7 +116,7 @@ class Command(NoArgsCommand):
|
||||
|
||||
if att_name[0].isdigit():
|
||||
att_name = 'number_%s' % att_name
|
||||
extra_params['db_column'] = unicode(column_name)
|
||||
extra_params['db_column'] = six.text_type(column_name)
|
||||
comment_notes.append("Field renamed because it wasn't a "
|
||||
"valid Python identifier.")
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ def get_validation_errors(outfile, app=None):
|
||||
e.add(opts, "'%s' has a relation with model %s, which has either not been installed or is abstract." % (f.name, f.rel.to))
|
||||
# it is a string and we could not find the model it refers to
|
||||
# so skip the next section
|
||||
if isinstance(f.rel.to, (str, unicode)):
|
||||
if isinstance(f.rel.to, six.string_types):
|
||||
continue
|
||||
|
||||
# Make sure the related field specified by a ForeignKey is unique
|
||||
@@ -162,7 +162,7 @@ def get_validation_errors(outfile, app=None):
|
||||
e.add(opts, "'%s' has an m2m relation with model %s, which has either not been installed or is abstract." % (f.name, f.rel.to))
|
||||
# it is a string and we could not find the model it refers to
|
||||
# so skip the next section
|
||||
if isinstance(f.rel.to, (str, unicode)):
|
||||
if isinstance(f.rel.to, six.string_types):
|
||||
continue
|
||||
|
||||
# Check that the field is not set to unique. ManyToManyFields do not support unique.
|
||||
|
||||
@@ -169,7 +169,7 @@ class LocaleRegexProvider(object):
|
||||
except re.error as e:
|
||||
raise ImproperlyConfigured(
|
||||
'"%s" is not a valid regular expression: %s' %
|
||||
(regex, unicode(e)))
|
||||
(regex, six.text_type(e)))
|
||||
|
||||
self._regex_dict[language_code] = compiled_regex
|
||||
return self._regex_dict[language_code]
|
||||
|
||||
Reference in New Issue
Block a user