﻿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
22803	Move contains_aggregate from ExpressionNode to F	jorgecarleitao	jorgecarleitao	"Currently, `ExpressionNode.contains_aggregate` is calling `self.name`, which would raise an `AttributeError`
if it would be called by an instance of type `ExpressionNode`.

One way is to move it to `F` since it is the only subclass of `ExpressionNode` with an attribute name (and thus the intended class to be used).
This is not part of the Public API, but cleans `ExpressionNode` interface.

There is also a call of the form 

{{{
hasattr(obj[1], 'contains_aggregate')
}}}

in `django/models/db/sql/query.py` which could be simplified by this.

PR follows as comment."	Cleanup/optimization	closed	Database layer (models, ORM)	1.6	Normal	duplicate			Unreviewed	0	0	0	0	0	0
