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
This commit is contained in:
Adrian Holovaty 2006-01-30 05:26:31 +00:00
parent f0d3b56d76
commit 913ed88397
1 changed files with 3 additions and 3 deletions

View File

@ -271,9 +271,9 @@ class Model(object):
(backend.quote_name(field.column), op, backend.quote_name(field.column), (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) backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column), op)
param = str(getattr(self, field.attname)) param = str(getattr(self, field.attname))
q = self.__class__._default_manager q = self.__class__._default_manager.order_by((not is_next and '-' or '') + field.name, (not is_next and '-' or '') + self._meta.pk.name)
q = q.order_by((not is_next and '-' or '') + field.name, (not is_next and '-' or '') + self._meta.pk.name) q._where.append(where)
q = q.extra(where=where, params=[param, param, getattr(self, self._meta.pk.attname)]) q._params.extend([param, param, getattr(self, self._meta.pk.attname)])
return q[0] return q[0]
def _get_next_or_previous_in_order(self, is_next): def _get_next_or_previous_in_order(self, is_next):