diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2009-12-19 15:02:46 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2009-12-19 15:02:46 +0000 |
| commit | e4757ec7afd54861e0c34d9b0f5edbbac4e2b860 (patch) | |
| tree | ac968f3a5e1c4f8d6968ed8c6ccef16a4904b0c9 /django/db/models/query.py | |
| parent | 7efd96844da89219b6fa5a9adfac4e5ff477b833 (diff) | |
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
Diffstat (limited to 'django/db/models/query.py')
| -rw-r--r-- | django/db/models/query.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index ab85bdc348..84af1bec60 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -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] |
