1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #10202 -- Fixed another couple of slicing edge-cases with querysets.

Patch from Alex Gaynor and Ramiro Morales.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9924 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2009-03-01 01:24:03 +00:00
parent 5fcd75ce14
commit bbea457fbb
2 changed files with 9 additions and 3 deletions

View File

@@ -903,11 +903,17 @@ used in lookups.
>>> Item.objects.filter(created__in=[time1, time2])
[<Item: one>, <Item: two>]
Bug #7698 -- People like to slice with '0' as the high-water mark.
Bug #7698, #10202 -- People like to slice with '0' as the high-water mark.
>>> Item.objects.all()[0:0]
[]
>>> Item.objects.all()[0:0][:10]
[]
>>> Item.objects.all()[:0].count()
0
>>> Item.objects.all()[:0].latest('created')
Traceback (most recent call last):
...
AssertionError: Cannot change a query once a slice has been taken.
Bug #7411 - saving to db must work even with partially read result set in
another cursor.