Fixed bug in Model._get_next_or_previous_in_order()

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3046 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-06-01 15:01:22 +00:00
parent 56131d0fb9
commit 8cd32bddab
1 changed files with 1 additions and 1 deletions

View File

@ -279,7 +279,7 @@ class Model(object):
order_field = self._meta.order_with_respect_to
where = ['%s %s (SELECT %s FROM %s WHERE %s=%%s)' % \
(backend.quote_name('_order'), op, backend.quote_name('_order'),
backend.quote_name(opts.db_table), backend.quote_name(opts.pk.column)),
backend.quote_name(self._meta.db_table), backend.quote_name(self._meta.pk.column)),
'%s=%%s' % backend.quote_name(order_field.column)]
params = [self._get_pk_val(), getattr(self, order_field.attname)]
obj = self._default_manager.order_by('_order').extra(where=where, params=params)[:1].get()