Fixes #19092: scope type selection lost when editing multiple/all objects #19102
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.
Fixes: #19092
This essentially reverts the previous fix for #18964, which attempted to fix the issue with some objects not being updated when the "select all s matching query" checkbox was marked by restoring an
else
clause that had been removed in the fix for #18194. However, doing so regressed the fix for #18194 while still leaving most of the changes for that fix in place.Rather than trying to guess all of the possible fields that might need to be stuffed in to
initial_data
across all bulk edit view/form combinations, I took the approach of making a copy ofrequest.POST
and over-writing thepk
list with what ever we determined to use earlier in theBulkEditView.post()
method. With this approach, anything that is set in the form is still transmitted to the form instance viarequest.POST
but thepk
list set ininitial_data
is instead overridden by the expected value. The end result is that all users selections on the form, as well as the object selections to edit, are preserved for the next iteration of the form.