1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.8.x] Fixed #24615 -- ordering by expression not part of SELECT

Fixed queries where an expression was used in order_by() but the
expression wasn't in the query's select clause (for example the
expression could be masked by .values() call)

Thanks to Trac alias MattBlack85 for the report.
Backport of fb5c7748da from master.
This commit is contained in:
Anssi Kääriäinen
2015-04-15 08:46:19 +03:00
committed by Claude Paroz
parent c38d8f0f87
commit 70ff455a35
5 changed files with 25 additions and 1 deletions

View File

@@ -49,3 +49,7 @@ Bugfixes
remove usage of referencing views by dotted path in
:func:`~django.conf.urls.url` which is deprecated in Django 1.8
(:ticket:`24635`).
* Fixed queries where an expression was referenced in ``order_by()``, but wasn't
part of the select clause. An example query is
``qs.annotate(foo=F('field')).values('pk').order_by('foo'))`` (:ticket:`24615`).