{{{
diff --git a/django/db/models/query.py b/django/db/models/query.py
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -370,9 +370,10 @@ class QuerySet(object):
clone = self.filter(*args, **kwargs)
if self.query.can_filter() and not self.query.distinct_fields:
clone = clone.order_by()
+ clone = clone[:2]
num = len(clone)
if num == 1:
- return clone._result_cache[0]
+ return clone[0]
if not num:
raise self.model.DoesNotExist(
"%s matching query does not exist." %
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28681>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Uncategorized => Cleanup/optimization
Comment:
Duplicate of #6785.
--
Ticket URL: <https://code.djangoproject.com/ticket/28681#comment:1>
* status: new => closed
* resolution: => duplicate
--
Ticket URL: <https://code.djangoproject.com/ticket/28681#comment:2>