mirror of
https://github.com/django/django.git
synced 2025-10-29 16:46:11 +00:00
Fixed #7256 -- Corrected queryset code to return the correct set of columns when the query has an empty values() clause as well as extra selects from an extra() clause. Thanks to Nicolas Lara for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7636 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -513,7 +513,9 @@ class ValuesQuerySet(QuerySet):
|
||||
# names of the model fields to select.
|
||||
|
||||
def iterator(self):
|
||||
self.query.trim_extra_select(self.extra_names)
|
||||
if (not self.extra_names and
|
||||
len(self.field_names) != len(self.model._meta.fields)):
|
||||
self.query.trim_extra_select(self.extra_names)
|
||||
names = self.query.extra_select.keys() + self.field_names
|
||||
for row in self.query.results_iter():
|
||||
yield dict(zip(names, row))
|
||||
|
||||
Reference in New Issue
Block a user