Removed fossilized remnant of pre-magic removal m2m code. Thanks for the report, Baurzhan Ismagulov.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4bead6e99f
commit
77bdaa76df
1
AUTHORS
1
AUTHORS
|
@ -91,6 +91,7 @@ answer newbie questions, and generally made Django that much better:
|
|||
Kieran Holland <http://www.kieranholland.com>
|
||||
Robert Rock Howard <http://djangomojo.com/>
|
||||
Jason Huggins <http://www.jrandolph.com/blog/>
|
||||
Baurzhan Ismagulov <ibr@radix50.net>
|
||||
jcrasta@gmail.com
|
||||
Michael Josephson <http://www.sdjournal.com/>
|
||||
jpellerin@gmail.com
|
||||
|
|
|
@ -376,24 +376,6 @@ class Model(object):
|
|||
setattr(self, cachename, get_image_dimensions(filename))
|
||||
return getattr(self, cachename)
|
||||
|
||||
# Handles setting many-to-many related objects.
|
||||
# Example: Album.set_songs()
|
||||
def _set_related_many_to_many(self, rel_class, rel_field, id_list):
|
||||
id_list = map(int, id_list) # normalize to integers
|
||||
rel = rel_field.rel.to
|
||||
m2m_table = rel_field.m2m_db_table()
|
||||
this_id = self._get_pk_val()
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("DELETE FROM %s WHERE %s = %%s" % \
|
||||
(backend.quote_name(m2m_table),
|
||||
backend.quote_name(rel_field.m2m_column_name())), [this_id])
|
||||
sql = "INSERT INTO %s (%s, %s) VALUES (%%s, %%s)" % \
|
||||
(backend.quote_name(m2m_table),
|
||||
backend.quote_name(rel_field.m2m_column_name()),
|
||||
backend.quote_name(rel_field.m2m_reverse_name()))
|
||||
cursor.executemany(sql, [(this_id, i) for i in id_list])
|
||||
transaction.commit_unless_managed()
|
||||
|
||||
############################################
|
||||
# HELPER FUNCTIONS (CURRIED MODEL METHODS) #
|
||||
############################################
|
||||
|
|
Loading…
Reference in New Issue