Opened 10 years ago

Closed 10 years ago

#22803 closed Cleanup/optimization (duplicate)

Move contains_aggregate from ExpressionNode to F

Reported by: jorgecarleitao Owned by: jorgecarleitao
Component: Database layer (models, ORM) Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (2)

comment:1 by jorgecarleitao, 10 years ago

This will be fixed by Pull Request for #14030.

comment:2 by Tim Graham, 10 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top