Created
March 8, 2016 19:48
-
-
Save matburt/fab3d5eb2c9d442b3d96 to your computer and use it in GitHub Desktop.
Disable signals and trigger job deletion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db.models.signals import pre_save, post_save, pre_delete, post_delete, m2m_changed | |
| from awx.main.models import * | |
| | |
| def clear_signals(): | |
| s = [pre_save, post_save, pre_delete, post_delete, m2m_changed] | |
| for sig in s: | |
| sig.receivers = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sig_clear import clear_signals | |
| from django.db.models.signals import pre_save, post_save, pre_delete, post_delete, m2m_changed | |
| from awx.main.models import * | |
| clear_signals() | |
| assert len(post_delete.receivers) == 0 | |
| Job.objects.all().delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment