mirror of
https://github.com/django/django.git
synced 2025-10-29 16:46:11 +00:00
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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user