mirror of
https://github.com/django/django.git
synced 2025-08-17 01:00:32 +00:00
[1.9.x] Fixed #25597 -- Fixed crash with SplitArrayField and IntegerField on invalid value.
Backport of 1f07da3e29
from master
This commit is contained in:
parent
e764f92cda
commit
64a9115bce
3 changed files with 9 additions and 1 deletions
|
@ -509,6 +509,11 @@ class TestSplitFormField(PostgreSQLTestCase):
|
|||
self.assertFalse(form.is_valid())
|
||||
self.assertEqual(form.errors, {'array': ['Item 2 in the array did not validate: This field is required.']})
|
||||
|
||||
def test_invalid_integer(self):
|
||||
msg = 'Item 1 in the array did not validate: Ensure this value is less than or equal to 100.'
|
||||
with self.assertRaisesMessage(exceptions.ValidationError, msg):
|
||||
SplitArrayField(forms.IntegerField(max_value=100), size=2).clean([0, 101])
|
||||
|
||||
def test_rendering(self):
|
||||
class SplitForm(forms.Form):
|
||||
array = SplitArrayField(forms.CharField(), size=3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue