|
@@ -114,8 +114,8 @@ class IndexTogetherTests(IsolatedModelsTestCase):
|
|
|
errors = Bar.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("'index_together' refers to field 'field1' which is not "
|
|
|
- "local to model 'Bar'."),
|
|
|
+ "'index_together' refers to field 'field1' which is not "
|
|
|
+ "local to model 'Bar'.",
|
|
|
hint=("This issue may be caused by multi-table inheritance."),
|
|
|
obj=Bar,
|
|
|
id='models.E016',
|
|
@@ -135,8 +135,8 @@ class IndexTogetherTests(IsolatedModelsTestCase):
|
|
|
errors = Model.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("'index_together' refers to a ManyToManyField 'm2m', but "
|
|
|
- "ManyToManyFields are not permitted in 'index_together'."),
|
|
|
+ "'index_together' refers to a ManyToManyField 'm2m', but "
|
|
|
+ "ManyToManyFields are not permitted in 'index_together'.",
|
|
|
hint=None,
|
|
|
obj=Model,
|
|
|
id='models.E013',
|
|
@@ -241,8 +241,8 @@ class UniqueTogetherTests(IsolatedModelsTestCase):
|
|
|
errors = Model.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("'unique_together' refers to a ManyToManyField 'm2m', but "
|
|
|
- "ManyToManyFields are not permitted in 'unique_together'."),
|
|
|
+ "'unique_together' refers to a ManyToManyField 'm2m', but "
|
|
|
+ "ManyToManyFields are not permitted in 'unique_together'.",
|
|
|
hint=None,
|
|
|
obj=Model,
|
|
|
id='models.E013',
|
|
@@ -330,9 +330,9 @@ class FieldNamesTests(IsolatedModelsTestCase):
|
|
|
m2m_long_name = "verylongmodelnamezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz_id"
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ('Autogenerated column name too long for M2M field "%s". '
|
|
|
+ 'Autogenerated column name too long for M2M field "%s". '
|
|
|
'Maximum length is "%s" for database "%s".'
|
|
|
- % (m2m_long_name, self.max_column_name_length, self.column_limit_db_alias)),
|
|
|
+ % (m2m_long_name, self.max_column_name_length, self.column_limit_db_alias),
|
|
|
hint=("Use 'through' to create a separate model for "
|
|
|
"M2M and then set column_name using 'db_column'."),
|
|
|
obj=ModelWithLongField,
|
|
@@ -347,9 +347,9 @@ class FieldNamesTests(IsolatedModelsTestCase):
|
|
|
# name is longer than the limits of the database.
|
|
|
expected.append(
|
|
|
Error(
|
|
|
- ('Autogenerated column name too long for M2M field "%s_id". '
|
|
|
+ 'Autogenerated column name too long for M2M field "%s_id". '
|
|
|
'Maximum length is "%s" for database "%s".'
|
|
|
- % (long_field_name, self.max_column_name_length, self.column_limit_db_alias)),
|
|
|
+ % (long_field_name, self.max_column_name_length, self.column_limit_db_alias),
|
|
|
hint=("Use 'through' to create a separate model for "
|
|
|
"M2M and then set column_name using 'db_column'."),
|
|
|
obj=ModelWithLongField,
|
|
@@ -382,9 +382,9 @@ class FieldNamesTests(IsolatedModelsTestCase):
|
|
|
# without specifying db_column
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ('Autogenerated column name too long for field "%s". '
|
|
|
+ 'Autogenerated column name too long for field "%s". '
|
|
|
'Maximum length is "%s" for database "%s".'
|
|
|
- % (long_field_name, self.max_column_name_length, self.column_limit_db_alias)),
|
|
|
+ % (long_field_name, self.max_column_name_length, self.column_limit_db_alias),
|
|
|
hint="Set the column name manually using 'db_column'.",
|
|
|
obj=ModelWithLongField,
|
|
|
id='models.E018',
|
|
@@ -441,17 +441,17 @@ class ShadowingFieldsTests(IsolatedModelsTestCase):
|
|
|
errors = Child.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("The field 'id' from parent model "
|
|
|
- "'invalid_models_tests.mother' clashes with the field 'id' "
|
|
|
- "from parent model 'invalid_models_tests.father'."),
|
|
|
+ "The field 'id' from parent model "
|
|
|
+ "'invalid_models_tests.mother' clashes with the field 'id' "
|
|
|
+ "from parent model 'invalid_models_tests.father'.",
|
|
|
hint=None,
|
|
|
obj=Child,
|
|
|
id='models.E005',
|
|
|
),
|
|
|
Error(
|
|
|
- ("The field 'clash' from parent model "
|
|
|
- "'invalid_models_tests.mother' clashes with the field 'clash' "
|
|
|
- "from parent model 'invalid_models_tests.father'."),
|
|
|
+ "The field 'clash' from parent model "
|
|
|
+ "'invalid_models_tests.mother' clashes with the field 'clash' "
|
|
|
+ "from parent model 'invalid_models_tests.father'.",
|
|
|
hint=None,
|
|
|
obj=Child,
|
|
|
id='models.E005',
|
|
@@ -474,8 +474,8 @@ class ShadowingFieldsTests(IsolatedModelsTestCase):
|
|
|
errors = Child.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("The field 'f' clashes with the field 'f_id' "
|
|
|
- "from model 'invalid_models_tests.parent'."),
|
|
|
+ "The field 'f' clashes with the field 'f_id' "
|
|
|
+ "from model 'invalid_models_tests.parent'.",
|
|
|
hint=None,
|
|
|
obj=Child._meta.get_field('f'),
|
|
|
id='models.E006',
|
|
@@ -519,8 +519,8 @@ class ShadowingFieldsTests(IsolatedModelsTestCase):
|
|
|
errors = Model.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("The field 'fk_id' clashes with the field 'fk' from model "
|
|
|
- "'invalid_models_tests.model'."),
|
|
|
+ "The field 'fk_id' clashes with the field 'fk' from model "
|
|
|
+ "'invalid_models_tests.model'.",
|
|
|
hint=None,
|
|
|
obj=Model._meta.get_field('fk_id'),
|
|
|
id='models.E006',
|
|
@@ -540,7 +540,8 @@ class OtherModelTests(IsolatedModelsTestCase):
|
|
|
errors = Model.check()
|
|
|
expected = [
|
|
|
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=Model,
|
|
|
id='models.E004',
|
|
@@ -556,8 +557,8 @@ class OtherModelTests(IsolatedModelsTestCase):
|
|
|
errors = Model.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("'ordering' must be a tuple or list "
|
|
|
- "(even if you want to order by only one field)."),
|
|
|
+ "'ordering' must be a tuple or list "
|
|
|
+ "(even if you want to order by only one field).",
|
|
|
hint=None,
|
|
|
obj=Model,
|
|
|
id='models.E014',
|
|
@@ -662,8 +663,8 @@ class OtherModelTests(IsolatedModelsTestCase):
|
|
|
errors = Model.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("'TEST_SWAPPED_MODEL_BAD_MODEL' references 'not_an_app.Target', "
|
|
|
- 'which has not been installed, or is abstract.'),
|
|
|
+ "'TEST_SWAPPED_MODEL_BAD_MODEL' references 'not_an_app.Target', "
|
|
|
+ 'which has not been installed, or is abstract.',
|
|
|
hint=None,
|
|
|
obj=None,
|
|
|
id='models.E002',
|
|
@@ -688,8 +689,8 @@ class OtherModelTests(IsolatedModelsTestCase):
|
|
|
errors = Group.check()
|
|
|
expected = [
|
|
|
Error(
|
|
|
- ("The model has two many-to-many relations through "
|
|
|
- "the intermediate model 'invalid_models_tests.Membership'."),
|
|
|
+ "The model has two many-to-many relations through "
|
|
|
+ "the intermediate model 'invalid_models_tests.Membership'.",
|
|
|
hint=None,
|
|
|
obj=Group,
|
|
|
id='models.E003',
|