From eee34ef64c026e3274c6d1b4fa2baffbc956b954 Mon Sep 17 00:00:00 2001 From: Matthias Erll Date: Sat, 17 May 2014 14:59:57 +0200 Subject: Fixed #22550 -- Prohibited QuerySet.last()/reverse() after slicing. --- docs/topics/db/queries.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/topics') diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt index b95173773b..b6263a9f42 100644 --- a/docs/topics/db/queries.txt +++ b/docs/topics/db/queries.txt @@ -361,6 +361,9 @@ every *second* object of the first 10:: >>> Entry.objects.all()[:10:2] +Further filtering or ordering of a sliced queryset is prohibited due to the +ambiguous nature of how that might work. + To retrieve a *single* object rather than a list (e.g. ``SELECT foo FROM bar LIMIT 1``), use a simple index instead of a slice. For example, this returns the first ``Entry`` in the database, after -- cgit v1.3