def to_internal_value(self, data):
        """
        List of dicts of native values <- List of dicts of primitive datatypes.
        """
        if html.is_html_input(data):
            data = html.parse_html_list(data)

        if not isinstance(data, list):
            message = self.error_messages['not_a_list'].format(
                input_type=type(data).__name__
            )
            raise ValidationError({
                api_settings.NON_FIELD_ERRORS_KEY: [message]
            })

        if not self.allow_empty and len(data) == 0:
            message = self.error_messages['empty']
            raise ValidationError({
                api_settings.NON_FIELD_ERRORS_KEY: [message]
            })

        ret = []
        errors = []

        for item in data:
            try:
                validated = self.child.run_validation(item)
            except ValidationError as exc:
                errors.append(exc.detail)
            else:
                ret.append(validated)
                errors.append({})

        if any(errors):
            raise ValidationError(errors)

        return ret
def to_internal_value ( self , data ) : if html . is_html_input ( data ) : data = html . parse_html_list ( data ) if not isinstance ( data , list ) : message = self . error_messages [ 'not_a_list' ] . format ( input_type = type ( data ) . __name__ ) raise ValidationError ( { api_settings . NON_FIELD_ERRORS_KEY : [ message ] } ) if not self . allow_empty and len ( data ) == 0 : message = self . error_messages [ 'empty' ] raise ValidationError ( { api_settings . NON_FIELD_ERRORS_KEY : [ message ] } ) ret = [ ] errors = [ ] for item in data : try : validated = self . child . run_validation ( item ) except ValidationError as exc : errors . append ( exc . detail ) else : ret . append ( validated ) errors . append ( { } ) if any ( errors ) : raise ValidationError ( errors ) return ret
List of dicts of native values <- List of dicts of primitive datatypes.