﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28049	ArrayField of IntegerField-s with Choices does not pass validation	Denis Sumin	nobody	"I have an ArrayField with IntegerField inside, and the IntegerField has choices.
Widgets return back a list of strings (instead of a list of integers). That is why the validation fails.
I've found that changing ArrayField.to_python from this

{{{
    def to_python(self, value):
        if isinstance(value, six.string_types):
            # Assume we're deserializing
            vals = json.loads(value)
            value = [self.base_field.to_python(val) for val in vals]
        return value
}}}

to something like this

{{{
    def to_python(self, value):
        if isinstance(value, six.string_types):
            # Assume we're deserializing
            vals = json.loads(value)
            value = [self.base_field.to_python(val) for val in vals]
        elif isinstance(value, list):
            value = [self.base_field.to_python(val) for val in value]
        return value
}}}

fixes the problem."	Bug	closed	contrib.postgres	1.11	Normal	duplicate	arrayfield		Unreviewed	0	0	0	0	0	0
