diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_checks/tests.py | 6 | ||||
| -rw-r--r-- | tests/model_meta/tests.py | 5 | ||||
| -rw-r--r-- | tests/modeladmin/tests.py | 10 | ||||
| -rw-r--r-- | tests/sites_framework/tests.py | 2 |
4 files changed, 11 insertions, 12 deletions
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py index 2cf7f66d9d..c584cd42c9 100644 --- a/tests/admin_checks/tests.py +++ b/tests/admin_checks/tests.py @@ -583,7 +583,7 @@ class SystemChecksTestCase(SimpleTestCase): errors = BookAdmin(Book, AdminSite()).check() expected = [ checks.Error( - "The value of 'fields' cannot include the ManyToManyField 'authors', " + "The value of 'fields' cannot include the many-to-many field 'authors' " "because that field manually specifies a relationship model.", obj=BookAdmin, id='admin.E013', @@ -601,8 +601,8 @@ class SystemChecksTestCase(SimpleTestCase): errors = FieldsetBookAdmin(Book, AdminSite()).check() expected = [ checks.Error( - "The value of 'fieldsets[1][1][\"fields\"]' cannot include the ManyToManyField " - "'authors', because that field manually specifies a relationship model.", + "The value of 'fieldsets[1][1][\"fields\"]' cannot include the many-to-many field " + "'authors' because that field manually specifies a relationship model.", obj=FieldsetBookAdmin, id='admin.E013', ) diff --git a/tests/model_meta/tests.py b/tests/model_meta/tests.py index cfae4736fa..d662c8257c 100644 --- a/tests/model_meta/tests.py +++ b/tests/model_meta/tests.py @@ -33,8 +33,7 @@ class OptionsBaseTests(SimpleTestCase): model = None field = relation if direct else relation.field - m2m = isinstance(field, related.ManyToManyField) - return relation, model, direct, m2m + return relation, model, direct, bool(field.many_to_many) # many_to_many can be None class GetFieldsTests(OptionsBaseTests): @@ -69,7 +68,7 @@ class DataTests(OptionsBaseTests): def test_local_fields(self): def is_data_field(f): - return isinstance(f, Field) and not isinstance(f, related.ManyToManyField) + return isinstance(f, Field) and not f.many_to_many for model, expected_result in TEST_RESULTS['local_fields'].items(): fields = model._meta.local_fields diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index c7e4b2c29d..790d24f66d 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -633,7 +633,7 @@ class RawIdCheckTests(CheckTestCase): self.assertIsInvalid( ValidationTestModelAdmin, ValidationTestModel, - "The value of 'raw_id_fields[0]' must be a ForeignKey or ManyToManyField.", + "The value of 'raw_id_fields[0]' must be a foreign key or a many-to-many field.", 'admin.E003') def test_valid_case(self): @@ -826,7 +826,7 @@ class FilterVerticalCheckTests(CheckTestCase): self.assertIsInvalid( ValidationTestModelAdmin, ValidationTestModel, - "The value of 'filter_vertical[0]' must be a ManyToManyField.", + "The value of 'filter_vertical[0]' must be a many-to-many field.", 'admin.E020') def test_valid_case(self): @@ -863,7 +863,7 @@ class FilterHorizontalCheckTests(CheckTestCase): self.assertIsInvalid( ValidationTestModelAdmin, ValidationTestModel, - "The value of 'filter_horizontal[0]' must be a ManyToManyField.", + "The value of 'filter_horizontal[0]' must be a many-to-many field.", 'admin.E020') def test_valid_case(self): @@ -960,7 +960,7 @@ class PrepopulatedFieldsCheckTests(CheckTestCase): self.assertIsInvalid( ValidationTestModelAdmin, ValidationTestModel, ("The value of 'prepopulated_fields' refers to 'users', which must not be " - "a DateTimeField, ForeignKey or ManyToManyField."), + "a DateTimeField, a foreign key, or a many-to-many field."), 'admin.E028') def test_valid_case(self): @@ -998,7 +998,7 @@ class ListDisplayTests(CheckTestCase): self.assertIsInvalid( ValidationTestModelAdmin, ValidationTestModel, - "The value of 'list_display[0]' must not be a ManyToManyField.", + "The value of 'list_display[0]' must not be a many-to-many field.", 'admin.E109') def test_valid_case(self): diff --git a/tests/sites_framework/tests.py b/tests/sites_framework/tests.py index 6d2717457a..de37bb5a00 100644 --- a/tests/sites_framework/tests.py +++ b/tests/sites_framework/tests.py @@ -62,7 +62,7 @@ class CurrentSiteManagerChecksTests(SimpleTestCase): expected = [ checks.Error( "CurrentSiteManager cannot use 'ConfusedArticle.site' as it is " - "not a ForeignKey or ManyToManyField.", + "not a foreign key or a many-to-many field.", obj=ConfusedArticle.on_site, id='sites.E002', ) |
