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

[1.9.x] Fixed #25867 -- Fixed a system check crash with nested ArrayFields.

Thanks to Jean Gourds for the report, Tim and Claude for the review.

Backport of 59b57e672c from master
This commit is contained in:
Simon Charette
2015-12-04 13:14:12 -05:00
parent 0154702a98
commit c0da598077
3 changed files with 34 additions and 3 deletions

View File

@@ -347,7 +347,9 @@ class TestChecks(PostgreSQLTestCase):
model = MyModel()
errors = model.check()
self.assertEqual(len(errors), 1)
# The inner CharField is missing a max_length.
self.assertEqual(errors[0].id, 'postgres.E001')
self.assertIn('max_length', errors[0].msg)
def test_invalid_base_fields(self):
test_apps = Apps(['postgres_tests'])
@@ -363,6 +365,25 @@ class TestChecks(PostgreSQLTestCase):
self.assertEqual(len(errors), 1)
self.assertEqual(errors[0].id, 'postgres.E002')
def test_nested_field_checks(self):
"""
Nested ArrayFields are permitted.
"""
test_apps = Apps(['postgres_tests'])
class MyModel(PostgreSQLModel):
field = ArrayField(ArrayField(models.CharField()))
class Meta:
apps = test_apps
model = MyModel()
errors = model.check()
self.assertEqual(len(errors), 1)
# The inner CharField is missing a max_length.
self.assertEqual(errors[0].id, 'postgres.E001')
self.assertIn('max_length', errors[0].msg)
@unittest.skipUnless(connection.vendor == 'postgresql', "PostgreSQL specific tests")
class TestMigrations(TransactionTestCase):