when saving a model with m2m field in the admin, 'clear' and 'add' m2m_changed signals are fired even when there is no change.
|Reported by:||benc||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||yes|
Description (last modified by ramiro)
I've built a simple test project with one app and two models, Model1 and Model2.
Model2 has a ManyToManyField to Model1.
I've created one Model1 instance and one Model2 instance with a relation to the Model1 instance.
When saving the Model2 instance in the admin, even without a change, m2m_changed fires twice.
I think it shouldn't fire at all when the admin form is saved without a change:
sender <class 'testproject.testapp.models.Model2_models1'> instance Model2 object action clear model <class 'testproject.testapp.models.Model1'> sender <class 'testproject.testapp.models.Model2_models1'> instance Model2 object action add model <class 'testproject.testapp.models.Model1'>
Change History (7)
Changed 6 years ago by benc
comment:1 Changed 6 years ago by ramiro
- Description modified (diff)
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 6 years ago by russellm
- Resolution set to wontfix
- Status changed from new to closed
Changed 6 years ago by halldor89
comment:3 Changed 6 years ago by halldor89
- Has patch set
- Needs tests set
- Patch needs improvement set
- Resolution wontfix deleted
- Status changed from closed to reopened
comment:4 Changed 6 years ago by halldor89
- Component changed from django.contrib.admin to Database layer (models, ORM)