﻿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
36155	Improve error handling when complex annotations are not passed an alias	Vinko Mlacic	Vinko Mlacic	"When complex annotations are not passed an alias, the default alias is usually used. If the `annotate` arg does not define the default alias, an error saying ""Complex annotations require an alias"" is raised. 

This works fine with args that are subclasses of `Aggregate` subclass because the `default_alias` property on the `Aggregate` subclass raises that same `TypeError`.

However, when using expressions that are not `Aggregate` subclasses, this fails with an obscure message saying that `default_alias` is not a property on the expression object.

Code to reproduce:

== models.py:
{{{
class Book(models.Model):
    name = models.CharField(max_length=255)
}}}

== tests.py:
{{{
Book.objects.annotate(Value(""title""))
}}}


Similar happens with other non `Aggregate` types like: `F`, `Case` - `When`, `Subquery`, `Exists`, ..."	Cleanup/optimization	assigned	Database layer (models, ORM)	dev	Normal			Vinko Mlacic	Unreviewed	1	0	0	0	0	0
