1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Made QuerySet slicing return IndexError instead of DoesNotExist (and related changes).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2859 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant
2006-05-06 18:46:53 +00:00
parent 0727df90f0
commit 7a62bac56e
3 changed files with 10 additions and 7 deletions

View File

@@ -264,7 +264,10 @@ class Model(object):
q = self.__class__._default_manager.order_by((not is_next and '-' or '') + field.name, (not is_next and '-' or '') + self._meta.pk.name)
q._where.append(where)
q._params.extend([param, param, getattr(self, self._meta.pk.attname)])
return q[0]
try:
return q[0]
except IndexError, e:
raise self.DoesNotExist, e.args
def _get_next_or_previous_in_order(self, is_next):
cachename = "__%s_order_cache" % is_next