Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diconnect Singals Temporarily #696

Open
TITANHACKY opened this issue Jan 27, 2025 · 0 comments
Open

Diconnect Singals Temporarily #696

TITANHACKY opened this issue Jan 27, 2025 · 0 comments

Comments

@TITANHACKY
Copy link

TITANHACKY commented Jan 27, 2025

Hi Team,

I have a requirement to disconnect the post_delete signal temporarily in some places. I have tried disconnecting but it seems it is not working. Is this the default behavior or is there any way to disconnect? (for bulk delete operation)

I have enabled the audit log to all the models from the settings file.

Current failed implementation:

from django.db.models.signals import post_delete
from auditlog.receivers import log_delete

post_delete.disconnect(log_delete, sender=<Model>)

I couldn't able to use disable_auditlog()

with disable_auditlog():
    # Do things silently here

Since I'm using Django multi-tenant, for each deleted record the signal still gets triggered but the log is not inserted, and the Django multi-tenant executes a query to set the search path. This takes a lot of time if there are a lot of records. Is there any possible way to completely disconnect the signal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant