Author: jbronn Date: 2010-02-26 11:11:58 -0600 (Fri, 26 Feb 2010) New Revision: 12613
Modified: django/branches/releases/1.1.X/django/db/models/query.py django/branches/releases/1.1.X/tests/modeltests/aggregation/models.py Log: [1.1.X] Fixed #12608 -- No longer return inconsistent results when using values and values_list in conjunction with annotate. Thanks, Charlie Leifer. Backport of r12505 from trunk. Modified: django/branches/releases/1.1.X/django/db/models/query.py =================================================================== --- django/branches/releases/1.1.X/django/db/models/query.py 2010-02-26 17:06:09 UTC (rev 12612) +++ django/branches/releases/1.1.X/django/db/models/query.py 2010-02-26 17:11:58 UTC (rev 12613) @@ -871,6 +871,8 @@ # full list of fields, including extras and aggregates. if self._fields: fields = self._fields + fields = list(self._fields) + filter(lambda f: f not in self._fields, + aggregate_names) else: fields = names Modified: django/branches/releases/1.1.X/tests/modeltests/aggregation/models.py =================================================================== --- django/branches/releases/1.1.X/tests/modeltests/aggregation/models.py 2010-02-26 17:06:09 UTC (rev 12612) +++ django/branches/releases/1.1.X/tests/modeltests/aggregation/models.py 2010-02-26 17:11:58 UTC (rev 12613) @@ -362,4 +362,7 @@ >>> Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values_list('mean_age', >>> flat=True) [34.5] +>>> qs = Book.objects.values_list('price').annotate(count=Count('price')).order_by('-count', 'price') +>>> list(qs) == [(Decimal('29.69'), 2), (Decimal('23.09'), 1), (Decimal('30'), 1), (Decimal('75'), 1), (Decimal('82.8'), 1)] +True """} -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.