1
0
mirror of https://github.com/django/django.git synced 2025-10-29 08:36:09 +00:00

Fixed #9985 -- qs.values_list(...).values(...) was constructing incorrect SQL.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2009-01-08 05:49:03 +00:00
parent d068ad0c01
commit c5bdfab9ae
3 changed files with 20 additions and 1 deletions

View File

@@ -680,6 +680,7 @@ class ValuesQuerySet(QuerySet):
Called by the _clone() method after initializing the rest of the
instance.
"""
self.query.clear_select_fields()
self.extra_names = []
if self._fields:
if not self.query.extra_select:
@@ -704,7 +705,10 @@ class ValuesQuerySet(QuerySet):
Cloning a ValuesQuerySet preserves the current fields.
"""
c = super(ValuesQuerySet, self)._clone(klass, **kwargs)
c._fields = self._fields[:]
if not hasattr(c, '_fields'):
# Only clone self._fields if _fields wasn't passed into the cloning
# call directly.
c._fields = self._fields[:]
c.field_names = self.field_names
c.extra_names = self.extra_names
if setup and hasattr(c, '_setup_query'):