Author: mtredinnick
Date: 2007-10-14 22:31:37 -0500 (Sun, 14 Oct 2007)
New Revision: 6517

Modified:
   django/branches/queryset-refactor/django/db/models/query.py
   django/branches/queryset-refactor/django/db/models/sql/query.py
Log:
queryset-refactor: Fixed values(...).select_related(...) bug that was
introduced in [6512]. The lookup tests picked this up.


Modified: django/branches/queryset-refactor/django/db/models/query.py
===================================================================
--- django/branches/queryset-refactor/django/db/models/query.py 2007-10-15 
02:54:30 UTC (rev 6516)
+++ django/branches/queryset-refactor/django/db/models/query.py 2007-10-15 
03:31:37 UTC (rev 6517)
@@ -416,6 +416,7 @@
             field_names = [f.attname for f in fields]
 
         self.query.add_local_columns([f.column for f in fields])
+        self.query.default_cols = False
         self.field_names = field_names
 
     def _clone(self, klass=None, setup=False, **kwargs):

Modified: django/branches/queryset-refactor/django/db/models/sql/query.py
===================================================================
--- django/branches/queryset-refactor/django/db/models/sql/query.py     
2007-10-15 02:54:30 UTC (rev 6516)
+++ django/branches/queryset-refactor/django/db/models/sql/query.py     
2007-10-15 03:31:37 UTC (rev 6517)
@@ -75,6 +75,7 @@
         self.table_map = {}     # Maps table names to list of aliases.
         self.join_map = {}      # Maps join_tuple to list of aliases.
         self.rev_join_map = {}  # Reverse of join_map.
+        self.default_cols = True
 
         # SQL-related attributes
         self.select = []
@@ -129,6 +130,7 @@
         obj.alias_map = copy.deepcopy(self.alias_map)
         obj.join_map = copy.deepcopy(self.join_map)
         obj.rev_join_map = copy.deepcopy(self.rev_join_map)
+        obj.default_cols = self.default_cols
         obj.select = self.select[:]
         obj.tables = self.tables[:]
         obj.where = copy.deepcopy(self.where)
@@ -353,7 +355,7 @@
                     result.append(col.as_sql(quote_func=qn))
                     if hasattr(col, 'alias'):
                         aliases.append(col.alias)
-        else:
+        elif self.default_cols:
             table_alias = self.tables[0]
             result = ['%s.%s' % (qn(table_alias), qn(f.column))
                     for f in self.model._meta.fields]


--~--~---------~--~----~------------~-------~--~----~
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