From 54e5b9aa21736859d7d8899cbeda9fe91aee6e4f Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 28 Jun 2006 01:16:32 +0000 Subject: [PATCH] Fixed #2196 -- Fixed AttributeError in method_set_order. Thanks, fonso git-svn-id: http://code.djangoproject.com/svn/django/trunk@3220 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django/db/models/base.py b/django/db/models/base.py index 73abd018ff7..09e8eb3fc07 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -399,10 +399,10 @@ def method_set_order(ordered_obj, self, id_list): cursor = connection.cursor() # Example: "UPDATE poll_choices SET _order = %s WHERE poll_id = %s AND id = %s" sql = "UPDATE %s SET %s = %%s WHERE %s = %%s AND %s = %%s" % \ - (backend.quote_name(ordered_obj.db_table), backend.quote_name('_order'), - backend.quote_name(ordered_obj.order_with_respect_to.column), - backend.quote_name(ordered_obj.pk.column)) - rel_val = getattr(self, ordered_obj.order_with_respect_to.rel.field_name) + (backend.quote_name(ordered_obj._meta.db_table), backend.quote_name('_order'), + backend.quote_name(ordered_obj._meta.order_with_respect_to.column), + backend.quote_name(ordered_obj._meta.pk.column)) + rel_val = getattr(self, ordered_obj._meta.order_with_respect_to.rel.field_name) cursor.executemany(sql, [(i, rel_val, j) for i, j in enumerate(id_list)]) transaction.commit_unless_managed()