1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.8.x] Removed unnecessary parentheses in model check messages.

Backport of e144e0e237 from master
This commit is contained in:
Tim Graham
2015-02-09 08:53:58 -05:00
parent eb9fbc0b1d
commit 6e50fc9246
2 changed files with 50 additions and 45 deletions

View File

@@ -1200,7 +1200,8 @@ class Model(six.with_metaclass(ModelBase)):
app_label, model_name = cls._meta.swapped.split('.')
errors.append(
checks.Error(
("'%s' references '%s.%s', which has not been installed, or is abstract.") % (
"'%s' references '%s.%s', which has not been "
"installed, or is abstract." % (
cls._meta.swappable, app_label, model_name
),
hint=None,
@@ -1266,8 +1267,8 @@ class Model(six.with_metaclass(ModelBase)):
if signature in seen_intermediary_signatures:
errors.append(
checks.Error(
("The model has two many-to-many relations through "
"the intermediate model '%s.%s'.") % (
"The model has two many-to-many relations through "
"the intermediate model '%s.%s'." % (
f.rel.through._meta.app_label,
f.rel.through._meta.object_name
),
@@ -1290,8 +1291,8 @@ class Model(six.with_metaclass(ModelBase)):
if fields and not fields[0].primary_key and cls._meta.pk.name == 'id':
return [
checks.Error(
("'id' can only be used as a field name if the field also "
"sets 'primary_key=True'."),
"'id' can only be used as a field name if the field also "
"sets 'primary_key=True'.",
hint=None,
obj=cls,
id='models.E004',
@@ -1314,9 +1315,9 @@ class Model(six.with_metaclass(ModelBase)):
if clash:
errors.append(
checks.Error(
("The field '%s' from parent model "
"'%s' clashes with the field '%s' "
"from parent model '%s'.") % (
"The field '%s' from parent model "
"'%s' clashes with the field '%s' "
"from parent model '%s'." % (
clash.name, clash.model._meta,
f.name, f.model._meta
),
@@ -1341,8 +1342,8 @@ class Model(six.with_metaclass(ModelBase)):
if clash and not id_conflict:
errors.append(
checks.Error(
("The field '%s' clashes with the field '%s' "
"from model '%s'.") % (
"The field '%s' clashes with the field '%s' "
"from model '%s'." % (
f.name, clash.name, clash.model._meta
),
hint=None,
@@ -1368,7 +1369,8 @@ class Model(six.with_metaclass(ModelBase)):
if column_name and column_name in used_column_names:
errors.append(
checks.Error(
"Field '%s' has column name '%s' that is used by another field." % (f.name, column_name),
"Field '%s' has column name '%s' that is used by "
"another field." % (f.name, column_name),
hint="Specify a 'db_column' for the field.",
obj=cls,
id='models.E007'
@@ -1456,7 +1458,9 @@ class Model(six.with_metaclass(ModelBase)):
except KeyError:
errors.append(
checks.Error(
"'%s' refers to the non-existent field '%s'." % (option, field_name),
"'%s' refers to the non-existent field '%s'." % (
option, field_name,
),
hint=None,
obj=cls,
id='models.E012',
@@ -1466,9 +1470,9 @@ class Model(six.with_metaclass(ModelBase)):
if isinstance(field.rel, models.ManyToManyRel):
errors.append(
checks.Error(
("'%s' refers to a ManyToManyField '%s', but "
"ManyToManyFields are not permitted in '%s'.") % (
option, field_name, option
"'%s' refers to a ManyToManyField '%s', but "
"ManyToManyFields are not permitted in '%s'." % (
option, field_name, option,
),
hint=None,
obj=cls,
@@ -1480,7 +1484,7 @@ class Model(six.with_metaclass(ModelBase)):
checks.Error(
("'%s' refers to field '%s' which is not local "
"to model '%s'.") % (
option, field_name, cls._meta.object_name
option, field_name, cls._meta.object_name,
),
hint=("This issue may be caused by multi-table "
"inheritance."),