﻿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
14649	.save_m2m() will override any Many-to-Many relationships created via signals/save method overloading.	Chris Chambers	nobody	"Example:
{{{
# models.py

class Event(models.Model):
    calendars = models.ManyToManyField(Calendar, verbose_name=_('calendars'),
        blank=True, related_name='events'
    )

    def save(self, *args, **kwargs):
        super(Event, self).save(*args, **kwargs)
        if not self.calendars.exists():
            default_calendar = Calendar.objects.get(slug='')
            self.calendars.add(default_calendar)
}}}
However, when an admin creates an Event without specifying the calendar via the admin view:

{{{
# line 795, contrib.admin.options
self.save_model(request, new_object, form, change=False) # at this point, new_object.calendars.all() contains the default calendar
# line 796, contrib.admin.options
form.save_m2m()                                          # new_object.calendars is cleared.
}}}

The workaround is to provide a custom admin form, but this still seems counter intuitive. 
(Additional thought: being able to specify defaults for m2m fields (#2750) would avoid this issue, and provide a slighter cleaner UI, as the appropriate calendar would be pre-selected in the admin interface).

"		closed	Forms	1.2		wontfix	save_m2m, signals, post_save, save_method	Chris Chambers	Unreviewed	0	0	0	0	0	0
