Skip to content

Fixes #14079: Explicitly remove M2M assignments to objects being deleted to ensure change logging #15166

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

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

jeremystretch
Copy link
Member

Fixes: #14079

This extends the handle_deleted_object() signal receiver to inspect objects being deleted for reverse many-to-many relationships. For any that are found, we query the related model for objects associated with the object being deleted, and manually delete the association by calling remove() on the remote M2M field. This triggers an m2m_changed signal for the related object, ensuring that the change is logged.

@jeremystretch jeremystretch merged commit bd7d4a3 into develop Feb 16, 2024
@jeremystretch jeremystretch deleted the 14079-fix-reverse-m2m-change-logging branch February 16, 2024 16:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing change log entries for updated many-to-many fields as part of deletes
2 participants