Code

Ticket #9208: query.py.diff

File query.py.diff, 386 bytes (added by mstamat@…, 6 years ago)

fix for the behaviour of latest() when there are more than one entries that have the same "latest" timestamp

Line 
1--- ./django/db/models/query.py.9084    2008-09-25 17:12:31.000000000 +0300
2+++ ./django/db/models/query.py 2008-09-25 17:17:27.000000000 +0300
3@@ -352,6 +352,7 @@
4         obj = self._clone()
5         obj.query.set_limits(high=1)
6         obj.query.add_ordering('-%s' % latest_by)
7+        obj.query.add_ordering('-%s' % 'pk')
8         return obj.get()
9 
10     def in_bulk(self, id_list):