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

AFTER_DELETE hook not triggered on when admin page "Delete selected objects" is used on the list view #142

Closed
Kazhuu opened this issue Nov 4, 2023 · 2 comments
Labels
duplicate This issue or pull request already exists wontfix This will not be worked on

Comments

@Kazhuu
Copy link

Kazhuu commented Nov 4, 2023

We used this neat library to add AFTER_DELETE hook to our child model to delete parent object automatically when all it's child objects are deleted. After some debugging we noticed that if models are deleted individually, the hook gets called as expected. However it seems if the admin page "delete selected objects" action is used on the list view even for one object. The hook doesn't seem to get called at all. Is this a bug or known issue? If this is a bug I'd be happy to contribute a solution to this because we need this behavior. If this is something that cannot be addressed meaningful way, maybe adding a note about this to the documentation would be a good thing to do.

What do you think? And thanks for this amazing library!

EDIT: Okay I browsed through the closed issues and found this #74. It seems this is a limitation from Django side. Should this be something added to the docs somewhere, so this does not necessarily comes as a surprise or the user thinks this is not a bug in the library?

@EnriqueSoria
Copy link
Collaborator

EnriqueSoria commented Nov 4, 2023

Yes, we should add a "common gotchas" in the documentation. #143

For your use case you could override ModelAdmin.delete_queryset so it performs deletion using model's delete, as suggested in the django docs

@EnriqueSoria EnriqueSoria added duplicate This issue or pull request already exists wontfix This will not be worked on labels Nov 4, 2023
@Kazhuu
Copy link
Author

Kazhuu commented Nov 4, 2023

Okay thanks for the prompt reply. This issue can be closed 👍

@EnriqueSoria EnriqueSoria closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants