﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
1861	Many2Many problem in AutomaticManipulator, uses premagicremoval 'set_xxx' method	mattias@…	Adrian Holovaty	"Missing magic removal change?

Revision: 2901

Exception Value: 'Package' object has no attribute 'set_labels'
Exception Location: <mypath>/django/db/models/manipulators.py in save, line 218

Basic version of my models, the exception occurs when using the admin site.
{{{
class A(models.Model):
 ...

class Label(models.Model):
 ...

class Package(models.Model):
    labels = models.ManyToManyField(Label, blank=True, null=True, raw_id_admin=False)
    a = models.ForeignKey(A, edit_inline=models.STACKED)
}}}


If you read RemovingTheMagic in the wiki it says that Many-to-many related lookups has changed and doesn't use set_<name> any more but instead uses <name>.add and so on... My guess is that this is the cause of the problem.
{{{
#django/db/models/manipulators.py:215-218
# Save many-to-many objects.
for f in related.opts.many_to_many:
    if child_follow.get(f.name, None) and not f.rel.edit_inline:
        was_changed = getattr(new_rel_obj, 'set_%s' % f.name)(rel_new_data[f.attname])
}}}
I don't quite grasp the code in manipulators.py so I'm not able to supply a patch. "	defect	closed	contrib.admin	dev	major	duplicate			Unreviewed	0	0	0	0	0	0
