Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #40 -- Removed legacy code from meta.py method_set_related_many…

…_to_many(). Thanks, jforeman@hark.org

git-svn-id: http://code.djangoproject.com/svn/django/trunk@157 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 58df4ce6364643732c6b2d9ab2d4a0254f5e1a89 1 parent 6ae4def
Adrian Holovaty authored July 17, 2005

Showing 1 changed file with 2 additions and 6 deletions. Show diff stats Hide diff stats

  1. 8  django/core/meta.py
8  django/core/meta.py
@@ -894,12 +894,8 @@ def method_set_related_many_to_many(rel_opts, rel_field, self, id_list):
894 894
     this_id = getattr(self, self._meta.pk.name)
895 895
     cursor = db.db.cursor()
896 896
     cursor.execute("DELETE FROM %s WHERE %s_id = %%s" % (m2m_table, rel.object_name.lower()), [this_id])
897  
-    if rel_field.rel.orderable:
898  
-        sql = "INSERT INTO %s (%s_id, %s_id, _order) VALUES (%%s, %%s, %%s)" % (m2m_table, rel.object_name.lower(), rel_opts.object_name.lower())
899  
-        cursor.executemany(sql, [(this_id, j, i) for i, j in enumerate(id_list)])
900  
-    else:
901  
-        sql = "INSERT INTO %s (%s_id, %s_id) VALUES (%%s, %%s)" % (m2m_table, rel.object_name.lower(), rel_opts.object_name.lower())
902  
-        cursor.executemany(sql, [(this_id, i) for i in id_list])
  897
+    sql = "INSERT INTO %s (%s_id, %s_id) VALUES (%%s, %%s)" % (m2m_table, rel.object_name.lower(), rel_opts.object_name.lower())
  898
+    cursor.executemany(sql, [(this_id, i) for i in id_list])
903 899
     db.db.commit()
904 900
 
905 901
 # ORDERING METHODS #########################

0 notes on commit 58df4ce

Please sign in to comment.
Something went wrong with that request. Please try again.