From 9dd244394236388c3479ab202a0ec31055f7ec09 Mon Sep 17 00:00:00 2001 From: Romulo Furtado Date: Thu, 6 Apr 2017 11:06:11 -0300 Subject: Fixed #27161 -- Fixed form validation when an ArrayField's base_field has choices. --- tests/postgres_tests/test_array.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/postgres_tests/test_array.py') diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index a66c92a016..e2e4ccdeb2 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -686,6 +686,11 @@ class TestSimpleFormField(PostgreSQLTestCase): self.assertIsInstance(form_field, SimpleArrayField) self.assertEqual(form_field.max_length, 4) + def test_model_field_choices(self): + model_field = ArrayField(models.IntegerField(choices=((1, 'A'), (2, 'B')))) + form_field = model_field.formfield() + self.assertEqual(form_field.clean('1,2'), [1, 2]) + def test_already_converted_value(self): field = SimpleArrayField(forms.CharField()) vals = ['a', 'b', 'c'] -- cgit v1.3