Opened 9 years ago

Closed 9 years ago

#24923 closed Cleanup/optimization (fixed)

Aggregates in order_by should error out nicely

Reported by: Anssi Kääriäinen Owned by: Tim Graham <timograham@…>
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Expressions are allowed in order_by, but aggregates don't currently work. Making them work would cause too much trouble when taking in account that you can already do

qs.annotate(agg=Sum('foo')).order_by('agg')

as opposed to

qs.order_by(Sum('foo'))

Change History (5)

comment:1 by Rigel Di Scala, 9 years ago

Owner: changed from nobody to Rigel Di Scala
Status: newassigned

akaariai: what would you suggest as the error message or behaviour?

comment:2 by Rigel Di Scala, 9 years ago

Owner: Rigel Di Scala removed
Status: assignednew

comment:3 by Simon Charette, 9 years ago

Patch needs improvement: set
Version: 1.8master

Left notes on the PR.

comment:4 by Anssi Kääriäinen, 9 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

I've fixed all review issues.

comment:5 by Tim Graham <timograham@…>, 9 years ago

Owner: set to Tim Graham <timograham@…>
Resolution: fixed
Status: newclosed

In 6f40305:

Fixed #24923 -- errored out nicely when using aggregates in order_by()

Note: See TracTickets for help on using tickets.
Back to Top