1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Changed Query.get_columns() to quote the 'AS' column names in an extra_select situation, to match pre-queryset-refactor behavior. Added unit tests that verify this and provide an example

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2008-04-28 21:15:05 +00:00
parent 13a6fd61c6
commit 14d6ee2dc9
2 changed files with 14 additions and 1 deletions

View File

@@ -394,7 +394,8 @@ class Query(object):
some cases to avoid ambiguitity with nested queries.
"""
qn = self.quote_name_unless_alias
result = ['(%s) AS %s' % (col, alias) for alias, col in self.extra_select.iteritems()]
qn2 = self.connection.ops.quote_name
result = ['(%s) AS %s' % (col, qn2(alias)) for alias, col in self.extra_select.iteritems()]
aliases = set(self.extra_select.keys())
if with_aliases:
col_aliases = aliases.copy()