Add ability to disable signals one a per-object-per-event basis.
|Reported by:||brooks.travis@…||Owned by:||nobody|
|Cc:||brooks.travis@…, michel@…||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Right now, built-in signals like pre_save and post_save are triggered for all models every time a new or existing instance is saved to the database. I would propose adding the capability to granularly disable any built-in signals on a per-event basis. Here's an example syntax:
>>>MyModel(name='John Doe', disabled_signals=['post_save'])
You should be able to pass this argument to a ModelForm instance, as well, and you could probably make it work for custom signals, but that's probably less necessary.
Adding the capability would make working with the build-in signals a lot less of a headache, particularly in my use-case, where a modification to one model with a signal listener attached, triggers a change to another model with a signal listener attached, but I don't want latter listener triggered every time the former is. Let me know if I'm not being clear.
Change History (17)
comment:1 Changed 6 years ago by mir
- milestone set to post-1.0
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:7 Changed 5 years ago by mtredinnick
- Component changed from Database layer (models, ORM) to Core framework