loaddata management command should provide option to disable signals
|Reported by:||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||master|
|Cc:||albrecht.andi@…, anssi.kaariainen@…||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Given a scenario such as a signal being called post_save to send a welcome email to a new user, the loaddata management command attempts to call this signal resulting in, at best but still no good, an email being sent to the user, or at worst, loaddata failure. Obviously, with as many times as one is likely to need to resync and reload data during development, it's not ideal to have a welcome email sent on every iteration.
Ideally, I'd like to see an argument that could be passed to loaddata to disable signal processing. Something along the lines of: "python manage.py loaddata mydata.json --nosignals". This method seems best, since potentially, there might be circumstances where you would want the signals processed. It would perhaps be even better if you could somehow pass a list of signals to disable, so you could selectively still have some signals processed.
As it stands, the issue can be solved easily enough by creating a wrapper around manage.py that disabled the necessary signals and then called loaddata, but this feel clunky.
As I have time, I will try to come up with a patch myself, if no one beats me to it. But I'm new to this kind of thing, so it may take me a little bit.
Change History (21)
comment:1 Changed 8 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|