﻿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
13713	Changing ModelMultipleChoiceField in admin is not reflected in override save() of the same model	jonathan_livni	nobody	"Consider the following:


{{{
class MyModel1 (models.Model):
    name                = models.CharField(max_length=200)

class MyModel2 (models.Model):
    my_model_1          = models.ManyToManyField(MyModel1, blank=True,null=True)
    city                = models.CharField(max_length=200)

    def save(self, *args, **kwargs):
        print ("","".join([mm1.name for mm1 in self.my_model_1.all()]))
        print (self.city)
        super(Filter, self).save(*args, **kwargs)
        print ("","".join([mm1.name for mm1 in self.my_model_1.all()]))
        print (self.city)
}}}

Admin presents my_model_1 field as ModelMultipleChoiceField widget.
Try changing this multi-choice field in admin a few times and you'll discover the bug...
self.city prints out with the updated value, the one you entered in the admin form, both before and after the super()
but... self.my_model1 retains the previous values in the printout, both before and after the super(), although in the db it is updated after the save() completes.

btw, this is the real but and not [http://code.djangoproject.com/ticket/13705 this] - my bad"		closed	Uncategorized	1.2		invalid			Unreviewed	0	0	0	0	0	0
