Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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 for the report, and jdunck for the patch

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 7efd968 commit e4757ec7afd54861e0c34d9b0f5edbbac4e2b860 @spookylukey spookylukey committed
Showing with 2 additions and 0 deletions.
  1. +2 −0  django/db/models/
2  django/db/models/
@@ -320,6 +320,8 @@ def get(self, *args, **kwargs):
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]

0 comments on commit e4757ec

Please sign in to comment.
Something went wrong with that request. Please try again.