﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14357	Prevent inappropriate order-based grouping on values+annotate queries	Martin Chase		"
{{{
class Foo(models.Model):
    name = models.TextField()
    type = models.TextField()

    class Meta:
        ordering = [""name"",]

Foo.objects.all().values(""type"").annotate(models.Count(""name""))
}}}
The above code fails to generate the expected result without adding {{{.order_by()}}} to the query set.

Ticket #10574 called this fixed with documentation, but indicated a proper fix would be preferred once backwards compatibility wasn't an issue.  Lest this fall off the radar for being closed, I am putting this ticket in for 2.0."	Bug	closed	Database layer (models, ORM)		Normal	fixed	3.1	Simon Charette Mariusz Felisiak	Someday/Maybe	0	0	0	0	0	0
