#28775: Queryset last() does not honor slices
-------------------------------------+-------------------------------------
Reporter: Liquid | Owner: nobody
Scorpio |
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Assume there is a time series of records for 100 days.
{{{
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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.0ca43aac241709ab4e509993b4468868%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.