mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #22550 -- Prohibited QuerySet.last()/reverse() after slicing.
This commit is contained in:
parent
84fb50df67
commit
eee34ef64c
5 changed files with 26 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue