Kaydet (Commit) ec16588c authored tarafından Hasan Ramezani's avatar Hasan Ramezani Kaydeden (comit) Tim Graham

Added test for Model._check_column_name_clashes().

üst 405ec5b9
......@@ -421,6 +421,21 @@ class FieldNamesTests(SimpleTestCase):
)
])
def test_db_column_clash(self):
class Model(models.Model):
foo = models.IntegerField()
bar = models.IntegerField(db_column='foo')
self.assertEqual(Model.check(), [
Error(
"Field 'bar' has column name 'foo' that is used by "
"another field.",
hint="Specify a 'db_column' for the field.",
obj=Model,
id='models.E007',
)
])
@isolate_apps('invalid_models_tests')
class ShadowingFieldsTests(SimpleTestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment