Opened 4 years ago

Closed 4 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


Currently, ExpressionNode.contains_aggregate is calling, 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/ which could be simplified by this.

PR follows as comment.

Change History (2)

comment:1 Changed 4 years ago by jorgecarleitao

This will be fixed by Pull Request for #14030.

comment:2 Changed 4 years ago by Tim Graham

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