Skip to content

Commit

Permalink
Fixed a missing variable initialisation deep in the Query bowels.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9081 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Sep 22, 2008
1 parent fd366a8 commit 922aba3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions django/db/models/sql/query.py
Expand Up @@ -808,6 +808,7 @@ def change_aliases(self, change_map):
self.where.relabel_aliases(change_map)
for pos, col in enumerate(self.select):
if isinstance(col, (list, tuple)):
old_alias = col[0]
self.select[pos] = (change_map.get(old_alias, old_alias), col[1])
else:
col.relabel_aliases(change_map)
Expand Down
5 changes: 5 additions & 0 deletions tests/regressiontests/queries/models.py
Expand Up @@ -966,6 +966,11 @@ def __unicode__(self):
>>> expected == result
True
Make sure bump_prefix() (an internal Query method) doesn't (re-)break.
>>> query = Tag.objects.values_list('id').order_by().query
>>> query.bump_prefix()
>>> print query.as_sql()[0]
SELECT U0."id" FROM "queries_tag" U0
"""}

# In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__
Expand Down

0 comments on commit 922aba3

Please sign in to comment.