Ticket #12258: d
File d, 458 bytes (added by , 15 years ago) |
---|
Line | |
---|---|
1 | diff --git a/django/db/models/query.py b/django/db/models/query.py |
2 | index 6a16ce1..f4baa2b 100644 |
3 | --- a/django/db/models/query.py |
4 | +++ b/django/db/models/query.py |
5 | @@ -320,6 +320,8 @@ class QuerySet(object): |
6 | keyword arguments. |
7 | """ |
8 | clone = self.filter(*args, **kwargs) |
9 | + if self.query.can_filter(): |
10 | + clone = clone.order_by() |
11 | num = len(clone) |
12 | if num == 1: |
13 | return clone._result_cache[0] |