1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #24171 -- Fixed failure with complex aggregate query and expressions

The query used a construct of qs.annotate().values().aggregate() where
the first annotate used an F-object reference and the values() and
aggregate() calls referenced that F-object.

Also made sure the inner query's select clause is as simple as possible,
and made sure .values().distinct().aggreate() works correctly.
This commit is contained in:
Anssi Kääriäinen
2015-03-04 14:56:20 +02:00
committed by Tim Graham
parent 63f2dd4ad7
commit fb146193c4
4 changed files with 48 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ from django.utils.encoding import python_2_unicode_compatible
class Employee(models.Model):
firstname = models.CharField(max_length=50)
lastname = models.CharField(max_length=50)
salary = models.IntegerField(blank=True, null=True)
def __str__(self):
return '%s %s' % (self.firstname, self.lastname)