magic-removal: fixed bug with indexing in QuerySet.__getitem__
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2201 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e51fcf8ec3
commit
758f1366c2
|
@ -98,7 +98,11 @@ class QuerySet(object):
|
||||||
# both be None at this point.
|
# both be None at this point.
|
||||||
if self._result_cache is None:
|
if self._result_cache is None:
|
||||||
if isinstance(k, slice):
|
if isinstance(k, slice):
|
||||||
return list(self._clone(_offset=k.start, _limit=k.stop))[::k.step]
|
if k.stop is not None and k.start is not None:
|
||||||
|
limit = k.stop - k.start
|
||||||
|
else:
|
||||||
|
limit = k.stop
|
||||||
|
return list(self._clone(_offset=k.start, _limit=limit))[::k.step]
|
||||||
else:
|
else:
|
||||||
return self._clone(_offset=k, _limit=1).get()
|
return self._clone(_offset=k, _limit=1).get()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue