Bug fix: prevent newly added (child) instances from being deleted soon after.#159
Open
amartis wants to merge 2 commits intobeda-software:masterfrom
Open
Bug fix: prevent newly added (child) instances from being deleted soon after.#159amartis wants to merge 2 commits intobeda-software:masterfrom
amartis wants to merge 2 commits intobeda-software:masterfrom
Conversation
…n after. When the Bug is happening: This happens when the request was made as mutlipart-form. Where the request data is not multi-layer dictionary, but instead plain HTTP multipart-form. Cause of Bug: The cause of the bug was the use of get_initial() to store primary keys (pk) in `update_or_create_reverse_relations()` get_initial() returns whole new object when the data is not nested dictionary but multipart-form where the key looks like `profile[0]message_set[0]message` And thus storing pk in that object is not persisted for `delete_reverse_relations_if_need()` Solution: Use attribute `nodelete_pks` to persist the data.
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.
When the Bug is happening:
This happens when the request was made as mutlipart-form.
Where the request data is not multi-layer dictionary, but instead plain HTTP multipart-form.
Cause of Bug:
The cause of the bug was the use of get_initial() to store primary keys (pk) in
update_or_create_reverse_relations()get_initial() returns whole new object when the data is not nested dictionary but multipart-form where the key looks like
profile[0]message_set[0]messageAnd thus storing pk in that object is not persisted for
delete_reverse_relations_if_need()Solution:
Use attribute
nodelete_pksto persist the data.