Fixed #14094 -- Added support for unlimited CharField on PostgreSQL.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
Adrian Torres 2022-11-10 19:31:31 +01:00 committed by Mariusz Felisiak
parent 78f163a4fb
commit 7eee1dca42
12 changed files with 78 additions and 15 deletions

View file

@ -776,12 +776,12 @@ class TestOtherTypesExactQuerying(PostgreSQLTestCase):
class TestChecks(PostgreSQLSimpleTestCase):
def test_field_checks(self):
class MyModel(PostgreSQLModel):
field = ArrayField(models.CharField())
field = ArrayField(models.CharField(max_length=-1))
model = MyModel()
errors = model.check()
self.assertEqual(len(errors), 1)
# The inner CharField is missing a max_length.
# The inner CharField has a non-positive max_length.
self.assertEqual(errors[0].id, "postgres.E001")
self.assertIn("max_length", errors[0].msg)
@ -837,12 +837,12 @@ class TestChecks(PostgreSQLSimpleTestCase):
"""
class MyModel(PostgreSQLModel):
field = ArrayField(ArrayField(models.CharField()))
field = ArrayField(ArrayField(models.CharField(max_length=-1)))
model = MyModel()
errors = model.check()
self.assertEqual(len(errors), 1)
# The inner CharField is missing a max_length.
# The inner CharField has a non-positive max_length.
self.assertEqual(errors[0].id, "postgres.E001")
self.assertIn("max_length", errors[0].msg)