﻿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
30548	Improve exceptions about mixed types in Expressions.	Keryn Knight	Shubham Bhagat	"The [https://github.com/django/django/blob/661e6cc2c97d9bcb45198be787409488e1825c90/django/db/models/expressions.py#L290 source which raises the exception] has enough information to say both what types were found, and which of those were unexpected, **and** probably have a useful `repr()`

In the test suite, the unexpected output types encountered seem to be `DurationField` and `IntegerField`, so a more thorough message might be something like:
`Expression repr(self) contained mixed types: DateField, DurationField. DurationField was unexpected; you must set the output_field= for this Expression to either DurationField(), DateField() or ...` (''??? I dunno, some concrete explanation of what the output_field has to be/implement if you're not going to use any of the builtins'')

The merit of including the repr is arguable, as the `Expression` may not what the user put in (eg: in the test suite it always seems to be a `CombinedExpression(lhs, connector, rhs)`) but it gives more of a hint in a query which contains multiple expressions (either nested or separate) as to which one is actually causing the problem vs just being told ""something was wrong. Put an output_field= everywhere until it ceases, your guess is as good as mine""; at the very least the word Expression could be replaced with the class name which is actually raising it."	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed	expressions orm		Accepted	1	0	0	0	1	0
