mirror of
https://github.com/django/django.git
synced 2025-09-23 02:33:31 +00:00
Fixed a suite of errors in the ORM -- a) fixed calling values_list().values_list() and changing whether the results are flat, b) fixed an issue with fields on the left-hand side of what becomes the HAVING clause not being included in the GROUP BY clause, and c) fixed a bug with fields from values() calls not being included in the GROUP BY clause. This fixed the recent test failures under postgresql.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3cbaf3c2b6
commit
678f626c24
6 changed files with 66 additions and 21 deletions
|
@ -965,8 +965,7 @@ class ValuesListQuerySet(ValuesQuerySet):
|
|||
# If a field list has been specified, use it. Otherwise, use the
|
||||
# full list of fields, including extras and aggregates.
|
||||
if self._fields:
|
||||
fields = list(self._fields) + filter(lambda f: f not in self._fields,
|
||||
aggregate_names)
|
||||
fields = list(self._fields) + filter(lambda f: f not in self._fields, aggregate_names)
|
||||
else:
|
||||
fields = names
|
||||
|
||||
|
@ -976,7 +975,9 @@ class ValuesListQuerySet(ValuesQuerySet):
|
|||
|
||||
def _clone(self, *args, **kwargs):
|
||||
clone = super(ValuesListQuerySet, self)._clone(*args, **kwargs)
|
||||
clone.flat = self.flat
|
||||
if not hasattr(clone, "flat"):
|
||||
# Only assign flat if the clone didn't already get it from kwargs
|
||||
clone.flat = self.flat
|
||||
return clone
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue