From bb77006adefae2db3fae0213779fc30254c1b98f Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Thu, 13 Sep 2007 03:17:46 +0000 Subject: [PATCH] Use the correct column in custom column handling. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6119 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/sql/query.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 21ce5282d4..97b4ee1a47 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -506,7 +506,7 @@ class Query(object): raise TypeError("Joins on field %r not permitted." % name) - name = target_col or name + col = target_col or target_field.column if target_field is opts.pk and last: # An optimization: if the final join is against a primary key, @@ -516,7 +516,7 @@ class Query(object): self.unref_alias(alias) join = self.alias_map[last[-1]][ALIAS_JOIN] alias = join[LHS_ALIAS] - name = join[LHS_JOIN_COL] + col = join[LHS_JOIN_COL] if (lookup_type == 'isnull' and value is True): # If the comparison is against NULL, we need to use a left outer @@ -525,7 +525,7 @@ class Query(object): # efficient at the database level. self.alias_map[joins[0]][ALIAS_JOIN][JOIN_TYPE] = self.LOUTER - self.where.add([alias, name, orig_field, lookup_type, value], + self.where.add([alias, col, orig_field, lookup_type, value], connection) if negate: self.alias_map[last[0]][ALIAS_JOIN][JOIN_TYPE] = self.LOUTER