mirror of https://github.com/django/django.git
Fixed #12258 - QuerySet.get() should clear ordering.
We only clear ordering when doing so cannot change the result returned by the get() method i.e. when the query does not already define limits. Thanks to mattdennewitz@gmail.com for the report, and jdunck for the patch git-svn-id: http://code.djangoproject.com/svn/django/trunk@11916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
7efd96844d
commit
e4757ec7af
|
@ -320,6 +320,8 @@ class QuerySet(object):
|
|||
keyword arguments.
|
||||
"""
|
||||
clone = self.filter(*args, **kwargs)
|
||||
if self.query.can_filter():
|
||||
clone = clone.order_by()
|
||||
num = len(clone)
|
||||
if num == 1:
|
||||
return clone._result_cache[0]
|
||||
|
|
Loading…
Reference in New Issue