From 913ed883979fc7938e43e74af8432593c7dcd56a Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 30 Jan 2006 05:26:31 +0000 Subject: [PATCH] magic-removal: Fixed bug in _get_next_or_previous_by_FIELD() git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2180 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/db/models/base.py b/django/db/models/base.py index b7f7e08315..82aeaedd58 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -271,9 +271,9 @@ class Model(object): (backend.quote_name(field.column), op, backend.quote_name(field.column), backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column), op) param = str(getattr(self, field.attname)) - q = self.__class__._default_manager - q = q.order_by((not is_next and '-' or '') + field.name, (not is_next and '-' or '') + self._meta.pk.name) - q = q.extra(where=where, params=[param, param, getattr(self, self._meta.pk.attname)]) + 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] def _get_next_or_previous_in_order(self, is_next):