summaryrefslogtreecommitdiff
path: root/tests/invalid_models_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/invalid_models_tests')
-rw-r--r--tests/invalid_models_tests/test_models.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 6ab13f18db..5b7042e127 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -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):