{{{
MyModel.objects.all().order_by('-date').last()
}}}
Returns the oldest record in the time series, which is same as returned
by:
{{{
MyModel.objects.all().order_by('-date')[:10].last()
}}}
This is not intuitive. Should return the 10th newest record, the slice
operator [:10] should be honoured.
--
Ticket URL: <https://code.djangoproject.com/ticket/28775>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => duplicate
Comment:
I believe this is a duplicate of #22550. In Django 2.0, this will throw a
`TypeError`. See, https://docs.djangoproject.com/en/dev/releases/2.0
/#queryset-reverse-and-last-are-prohibited-after-slicing.
--
Ticket URL: <https://code.djangoproject.com/ticket/28775#comment:1>