Fixes #18965: Ensure script list run buttons respect scripts' commit_default option #19013
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: #18965
For the ScriptListView, we're rendering one-off forms directly in HTML for each of the scripts in a module. Previous to this change, that form consisted only of a hidden CSRF token input and the Run/Run Again button. This meant that that the post handler was interpreting the incoming
request.POSTas indicating_commit=False, essentially.This change checks the script's associated
python_class.commit_defaultattribute and conditionally renders a hidden_commitcheckbox input for each script's form in ScriptListView so that the post handler will behave accordingly. This has the added benefit of ensuring that the commit default checkbox button is rendered checked or not correctly on the subsequent ScriptView if the RQ worker is not available.