diff options
| author | Justin Hamade <justhamade@gmail.com> | 2014-04-14 16:11:52 -0400 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2014-04-16 17:57:11 -0400 |
| commit | a13df671a5a5b867397ce05f73a59a3f4504868a (patch) | |
| tree | a322ce31001350845b3c0c1094a7ef04115cff49 /django/db/models/sql/where.py | |
| parent | 7cd74fc96ee982acfed7a98e76d4623eabde146d (diff) | |
Fixed #22434 -- Retain ordering on related sliced subqueries.
Thanks maciej.pawlisz for the report, and charettes for the review.
Diffstat (limited to 'django/db/models/sql/where.py')
| -rw-r--r-- | django/db/models/sql/where.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index 2b315be7c8..0fedb771b7 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -418,7 +418,9 @@ class SubqueryConstraint(object): else: query = query._clone() query = query.query - query.clear_ordering(True) + if query.can_filter(): + # If there is no slicing in use, then we can safely drop all ordering + query.clear_ordering(True) query_compiler = query.get_compiler(connection=connection) return query_compiler.as_subquery_condition(self.alias, self.columns, qn) |
