﻿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
29256	Need a save() call after assigning a many to many relation	Victor Porton	nobody	"As http://guido.vonrudorff.de/django-manytomany-relationship-and-unsaved-objects/ teaches (and our tests show too), `save()` should be called twice when using m2m fields:

{{{
parts = BarClass.objects.filter(label__in=['eggs', 'bacon', 'spam'])
foo = FooClass(label='lunch')
foo.save() # do not forget this line
foo.child = parts
foo.save()
}}}

It looks silly and counter-intuitive to call `save()` twice. Is this a bug?

At least the docs should say this vividly. So at very least we have a bug in documentation for not addressing this issue.

The model code used:

{{{
class BarClass(models.Model):
    label = models.CharField()
 
class FooClass(models.Model):
    label = models.CharField()
    child = models.ManyToManyField(BarClass)
}}}"	Bug	closed	Database layer (models, ORM)	1.11	Normal	invalid		Victor Porton	Unreviewed	0	0	0	0	0	0
