diff --git a/django/db/models/query.py b/django/db/models/query.py
index 58f9313..5bc650f 100644
a
|
b
|
class QuerySet(object):
|
403 | 403 | "Cannot change a query once a slice has been taken." |
404 | 404 | obj = self._clone() |
405 | 405 | obj.query.set_limits(high=1) |
| 406 | obj.query.clear_ordering() |
406 | 407 | obj.query.add_ordering('-%s' % latest_by) |
407 | 408 | return obj.get() |
408 | 409 | |
diff --git a/tests/modeltests/get_latest/tests.py b/tests/modeltests/get_latest/tests.py
index 3c3588b..a0f6e94 100644
a
|
b
|
class LatestTests(TestCase):
|
43 | 43 | a3, |
44 | 44 | ) |
45 | 45 | |
| 46 | # Checking to ensure latest() overrides any other ordering specified on the query |
| 47 | self.assertEqual(Article.objects.order_by('id').latest(), a4) |
| 48 | |
46 | 49 | def test_latest_manual(self): |
47 | 50 | # You can still use latest() with a model that doesn't have |
48 | 51 | # "get_latest_by" set -- just pass in the field name manually. |