def field_as_sql(self, field, val):
    '\n        Take a field and a value intended to be saved on that field, and\n        return placeholder SQL and accompanying params. Checks for raw values,\n        expressions and fields with get_placeholder() defined in that order.\n\n        When field is None, the value is considered raw and is used as the\n        placeholder, with no corresponding parameters returned.\n        '
    if (field is None):
        (sql, params) = (val, [])
    elif hasattr(val, 'as_sql'):
        (sql, params) = self.compile(val)
    elif hasattr(field, 'get_placeholder'):
        (sql, params) = (field.get_placeholder(val, self, self.connection), [val])
    else:
        (sql, params) = ('%s', [val])
    params = self.connection.ops.modify_insert_params(sql, params)
    return (sql, params)
Take a field and a value intended to be saved on that field, and
return placeholder SQL and accompanying params. Checks for raw values,
expressions and fields with get_placeholder() defined in that order.

When field is None, the value is considered raw and is used as the
placeholder, with no corresponding parameters returned.
def field_as_sql(self, field, val):
    '\n        Take a field and a value intended to be saved on that field, and\n        return placeholder SQL and accompanying params. Checks for raw values,\n        expressions and fields with get_placeholder() defined in that order.\n\n        When field is None, the value is considered raw and is used as the\n        placeholder, with no corresponding parameters returned.\n        '
    if (field is None):
        (sql, params) = (val, [])
    elif hasattr(val, 'as_sql'):
        (sql, params) = self.compile(val)
    elif hasattr(field, 'get_placeholder'):
        (sql, params) = (field.get_placeholder(val, self, self.connection), [val])
    else:
        (sql, params) = ('%s', [val])
    params = self.connection.ops.modify_insert_params(sql, params)
    return (sql, params)