5 | | On the other hand, `ModelAdmin.save_form` calls the `form.save` method and `ModelAdmin.save_model` calls the `obj.save` method, but `ModelAdmin.save_form` and `ModelAdmin.save_model` are called in the same flow (lines 1763,1764 and 1575,1580 in `django.contrib.admin.options`), i.e., both can be called in serial leading to multiple saves of the same object. This is specially important when using `signals` because two calls to save may trigger duplicate signals. Maybe a better documentation of that, a suggestion of which to use, and if it's possible an optimization of those calls would be great. |
| 5 | On the other hand, `ModelAdmin.save_form` calls the `form.save` method and `ModelAdmin.save_model` calls the `obj.save` method, but `ModelAdmin.save_form` and `ModelAdmin.save_model` are called in the same flow (lines 1763,1764 and 1575,1580 in `django.contrib.admin.options`), i.e., both can be called in serial leading to multiple saves of the same object. This is specially important when using `signals` because two calls to `obj.save` may trigger duplicate signals when listening to `post_save`, for example. Maybe a better documentation of that, a suggestion of which to use, and if it's possible an optimization of those calls would be great. |