Ticket #11283: query_latest_ordering.diff
File query_latest_ordering.diff, 932 bytes (added by , 15 years ago) |
---|
-
django/db/models/query.py
353 353 "Cannot change a query once a slice has been taken." 354 354 obj = self._clone() 355 355 obj.query.set_limits(high=1) 356 obj.query.clear_ordering() 356 357 obj.query.add_ordering('-%s' % latest_by) 357 358 return obj.get() 358 359 -
tests/modeltests/get_latest/models.py
76 76 77 77 >>> Person.objects.latest('birthday') 78 78 <Person: Stephanie> 79 80 # Checking to ensure latest() overrides any other ordering specified on the query 81 >>> Article.objects.order_by('id').latest() 82 <Article: Article 4> 79 83 """}