#28775 closed Bug (duplicate)

Queryset last() does not honor slices

Reported by: Liquid Scorpio Owned by: nobody
Component: Database layer (models, ORM) Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Assume there is a time series of records for 100 days.


Returns the oldest record in the time series, which is same as returned by:


This is not intuitive. Should return the 10th newest record, the slice operator [:10] should be honoured.

Change History (1)

comment:1 Changed 12 months ago by Jon Dufresne

Resolution: duplicate
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top