1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #28120 -- Checked that CharField.max_length is not a boolean.

This commit is contained in:
Carles Pina Estany
2017-04-25 00:49:31 +02:00
committed by Simon Charette
parent 851874fe0a
commit 9f2e8b5bb7
3 changed files with 18 additions and 1 deletions

View File

@@ -139,6 +139,21 @@ class CharFieldTests(TestCase):
]
self.assertEqual(errors, expected)
def test_str_max_length_type(self):
class Model(models.Model):
field = models.CharField(max_length=True)
field = Model._meta.get_field('field')
errors = field.check()
expected = [
Error(
"'max_length' must be a positive integer.",
obj=field,
id='fields.E121'
),
]
self.assertEqual(errors, expected)
def test_non_iterable_choices(self):
class Model(models.Model):
field = models.CharField(max_length=10, choices='bad')