def quote_name_unless_alias(self, name):
    "\n        A wrapper around connection.ops.quote_name that doesn't quote aliases\n        for table names. This avoids problems with some SQL dialects that treat\n        quoted strings specially (e.g. PostgreSQL).\n        "
    if (name in self.quote_cache):
        return self.quote_cache[name]
    if (((name in self.query.alias_map) and (name not in self.query.table_map)) or (name in self.query.extra_select) or ((name in self.query.external_aliases) and (name not in self.query.table_map))):
        self.quote_cache[name] = name
        return name
    r = self.connection.ops.quote_name(name)
    self.quote_cache[name] = r
    return r
A wrapper around connection.ops.quote_name that doesn't quote aliases
for table names. This avoids problems with some SQL dialects that treat
quoted strings specially (e.g. PostgreSQL).
def quote_name_unless_alias(self, name):
    "\n        A wrapper around connection.ops.quote_name that doesn't quote aliases\n        for table names. This avoids problems with some SQL dialects that treat\n        quoted strings specially (e.g. PostgreSQL).\n        "
    if (name in self.quote_cache):
        return self.quote_cache[name]
    if (((name in self.query.alias_map) and (name not in self.query.table_map)) or (name in self.query.extra_select) or ((name in self.query.external_aliases) and (name not in self.query.table_map))):
        self.quote_cache[name] = name
        return name
    r = self.connection.ops.quote_name(name)
    self.quote_cache[name] = r
    return r