Author: mtredinnick
Date: 2007-09-12 22:17:46 -0500 (Wed, 12 Sep 2007)
New Revision: 6119

Modified:
   django/branches/queryset-refactor/django/db/models/sql/query.py
Log:
Use the correct column in custom column handling.


Modified: django/branches/queryset-refactor/django/db/models/sql/query.py
===================================================================
--- django/branches/queryset-refactor/django/db/models/sql/query.py     
2007-09-13 03:11:44 UTC (rev 6118)
+++ django/branches/queryset-refactor/django/db/models/sql/query.py     
2007-09-13 03:17:46 UTC (rev 6119)
@@ -506,7 +506,7 @@
                     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 @@
             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 @@
             # 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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to