fix changes_display_dict to display added/deleted objects for m2m updates#464
Open
a-cesari wants to merge 5 commits intojazzband:masterfrom
Open
fix changes_display_dict to display added/deleted objects for m2m updates#464a-cesari wants to merge 5 commits intojazzband:masterfrom
a-cesari wants to merge 5 commits intojazzband:masterfrom
Conversation
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #464 +/- ##
==========================================
- Coverage 92.74% 92.17% -0.58%
==========================================
Files 26 26
Lines 786 792 +6
==========================================
+ Hits 729 730 +1
- Misses 57 62 +5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Contributor
|
@a-cesari, thanks for your patch! I indeed missed Could you please cover the added logic with a test? Can you also add a changelog entry for this feature? |
dengeeks
approved these changes
Oct 24, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In one of my projects I needed to use the changes_display_dict function in a Django template to display changes of a m2m field.
Apparently for such field the
changes_display_dictfunction is not storing the added/deleted object while thechanges_dictfunction does. The changes_display_dict function just store a list like this:['type', 'operation', 'objects'].See screenshots attached.
I slightly modified the
changes_display_dictfunction to also store the list of added/removed objects. The result is the following:I hope you could consider merging this if appropriate. Happy to implement any changes/improvements you might suggest on my current proposal.