﻿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
25550	Deprecate direct assignment to the reverse side of a related set	Tim Graham	nobody	"As [https://groups.google.com/d/topic/django-developers/RVivKK3vUnE/discussion proposed by Ansii] on django-developers:

{{{
>>> obj.reverse_fk_set = RelatedObj.objects.all()
}}}
What happens is that the `RelatedObj.objects.all()` queryset is
iterated and each object of the queryset is saved with the fk changed
to point to the `obj`. An implicit save.

Now, I don't like the implicit saves at all. A variable assignment
should not cause a database save. So, I would like to deprecate the
current behavior. Assignment to `reverse_fk_set` (and I guess this goes
for m2m, too) is no longer allowed. Instead you will need to
explicitly do:
{{{
 >>> obj.reverse_fk_set.set(RelatedObj.objects.all())
}}}
Now you are calling a method, and saving in this situation is OK and
analogous to other related manager methods.

Lets raise a deprecation warning on direct assignment to the
`reverse_fk_set` and remove it. The message would be
something like ""Direct assignment to the reverse side of a related set
is deprecated. Use .set() instead."" "	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed			Accepted	1	0	0	0	0	0
