Accessing updated M2M fields in overriden save() in django's admin -


I want to use the updated values ​​of a ManyToManyField user in a model overdraw () method when I have an example Save me in the admin

It has been found that, with the design, the mzm does not update the m2m field before saving it, but save ( form only after saving ...

Eg the prices shown in both print commands have been updated before example in the user's model:

  class MyClass (models.Model): an_m2m_field = model. ManyToManyField (MyOtherCLass) def save (self, * arg, ** kwargs): print self.n_m2m_field.all () super (MyClass, itself). Save (* args, ** kwargs) # "real" save () V Call the print itself.an_m2m_field.all ()  

How can I access the new values ​​of this field in the override save?

The M2M field is saved independently from the model. To work on the M2M field change, broadly, the M2M Register on the M2M_ selected sign of the field.


Comments