kolibri/core/serializers.py
def update_to_internal_value(self, data):

        """
        Dict of native values <- Dict of primitive datatypes.
        """
        if not isinstance(data, Mapping):
            message = self.error_messages["invalid"].format(
                datatype=type(data).__name__
            )
            raise ValidationError(
                {api_settings.NON_FIELD_ERRORS_KEY: [message]}, code="invalid"
            )

        ret = OrderedDict()
        errors = OrderedDict()
        fields = [
            self.fields[field_name]
            for field_name in data
            if field_name in self.fields
            if not self.fields[field_name].read_only
        ]

        for field in fields:
            # fields that are computed methods don't need validation:
            if field.read_only:
                continue
            validate_method = getattr(self, "validate_" + field.field_name, None)
            try:
                validated_value = field.run_validation(data[field.field_name])
                if validate_method is not None:
                    validated_value = validate_method(validated_value)
            except ValidationError as exc:
                errors[field.field_name] = exc.detail
            except DjangoValidationError as exc:
                errors[field.field_name] = get_error_detail(exc)
            except (KeyError, SkipField):
                pass

            else:
                set_value(ret, field.source_attrs, validated_value)

        if errors:
            raise ValidationError(errors)

        return ret

        Dict of native values <- Dict of primitive datatypes.
        
Dict of native values <- Dict of primitive datatypes.
Dict of native values < - Dict of primitive datatypes .
def update_to_internal_value(self, data):
        if not isinstance(data, Mapping):
            message = self.error_messages["invalid"].format(
                datatype=type(data).__name__
            )
            raise ValidationError(
                {api_settings.NON_FIELD_ERRORS_KEY: [message]}, code="invalid"
            )
        ret = OrderedDict()
        errors = OrderedDict()
        fields = [
            self.fields[field_name]
            for field_name in data
            if field_name in self.fields
            if not self.fields[field_name].read_only
        ]
        for field in fields:
            if field.read_only:
                continue
            validate_method = getattr(self, "validate_" + field.field_name, None)
            try:
                validated_value = field.run_validation(data[field.field_name])
                if validate_method is not None:
                    validated_value = validate_method(validated_value)
            except ValidationError as exc:
                errors[field.field_name] = exc.detail
            except DjangoValidationError as exc:
                errors[field.field_name] = get_error_detail(exc)
            except (KeyError, SkipField):
                pass
            else:
                set_value(ret, field.source_attrs, validated_value)
        if errors:
            raise ValidationError(errors)
        return ret
def update_to_internal_value ( self , data ) : if not isinstance ( data , Mapping ) : message = self . error_messages [ "invalid" ] . format ( datatype = type ( data ) . __name__ ) raise ValidationError ( { api_settings . NON_FIELD_ERRORS_KEY : [ message ] } , code = "invalid" ) ret = OrderedDict ( ) errors = OrderedDict ( ) fields = [ self . fields [ field_name ] for field_name in data if field_name in self . fields if not self . fields [ field_name ] . read_only ] for field in fields : if field . read_only : continue validate_method = getattr ( self , "validate_" + field . field_name , None ) try : validated_value = field . run_validation ( data [ field . field_name ] ) if validate_method is not None : validated_value = validate_method ( validated_value ) except ValidationError as exc : errors [ field . field_name ] = exc . detail except DjangoValidationError as exc : errors [ field . field_name ] = get_error_detail ( exc ) except ( KeyError , SkipField ) : pass else : set_value ( ret , field . source_attrs , validated_value ) if errors : raise ValidationError ( errors ) return ret
Dict of native values <- Dict of primitive datatypes.
Dict of native values < - Dict of primitive datatypes .
"""
        Dict of native values <- Dict of primitive datatypes.
        """ # fields that are computed methods don't need validation:
self
data