'Coerce the value returned by the database backend into a consistent type
that is compatible with the field type.'

def convert_values(self, value, field):

    if ((value is None) or (field is None)):
        return value
    internal_type = field.get_internal_type()
    if (internal_type == 'FloatField'):
        return float(value)
    elif (internal_type and (internal_type.endswith('IntegerField') or (internal_type == 'AutoField'))):
        return int(value)
    return value
