Fixed bug in metasystem method_get_next_in_order and method_get_previous_in_order, related to [549]

git-svn-id: http://code.djangoproject.com/svn/django/trunk@570 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-08-29 15:35:04 +00:00
parent b77114caaa
commit 25aef18d83
1 changed files with 2 additions and 2 deletions

View File

@ -849,7 +849,7 @@ def method_get_next_in_order(opts, order_field, self):
self._next_in_order_cache = opts.get_model_module().get_object(order_by=('_order',), self._next_in_order_cache = opts.get_model_module().get_object(order_by=('_order',),
where=['_order > (SELECT _order FROM %s WHERE %s=%%s)' % (opts.db_table, opts.pk.column), where=['_order > (SELECT _order FROM %s WHERE %s=%%s)' % (opts.db_table, opts.pk.column),
'%s=%%s' % order_field.column], limit=1, '%s=%%s' % order_field.column], limit=1,
params=[getattr(self, opts.pk.column), getattr(self, order_field.name)]) params=[getattr(self, opts.pk.column), getattr(self, order_field.column)])
return self._next_in_order_cache return self._next_in_order_cache
def method_get_previous_in_order(opts, order_field, self): def method_get_previous_in_order(opts, order_field, self):
@ -857,7 +857,7 @@ def method_get_previous_in_order(opts, order_field, self):
self._previous_in_order_cache = opts.get_model_module().get_object(order_by=('-_order',), self._previous_in_order_cache = opts.get_model_module().get_object(order_by=('-_order',),
where=['_order < (SELECT _order FROM %s WHERE %s=%%s)' % (opts.db_table, opts.pk.column), where=['_order < (SELECT _order FROM %s WHERE %s=%%s)' % (opts.db_table, opts.pk.column),
'%s=%%s' % order_field.column], limit=1, '%s=%%s' % order_field.column], limit=1,
params=[getattr(self, opts.pk.column), getattr(self, order_field.name)]) params=[getattr(self, opts.pk.column), getattr(self, order_field.column)])
return self._previous_in_order_cache return self._previous_in_order_cache
# RELATIONSHIP METHODS ##################### # RELATIONSHIP METHODS #####################