Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 54e5b9aa21736859d7d8899cbeda9fe91aee6e4f 1 parent 5d7af7b
Adrian Holovaty adrianholovaty authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 django/db/models/base.py
8 django/db/models/base.py
View
@@ -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()
Please sign in to comment.
Something went wrong with that request. Please try again.