Prevent ConditionsField.choice_kwargs from being shared across instances.
Review Request #10408 — Created Feb. 15, 2019 and submitted — Latest diff uploaded
ConditionsField.choice_kwargs, which is used to provide custom values
to pass to
ConditionChoiceinstances (for request state or anything
else) was getting shared across multiple
ConditionsFields for multiple
instances of the same form. The reason is that the
wasn't being copied when
Formcreates instance-specific copies of its
declared form fields.
We now perform the copy, but in the widget (which previously shared
ConditionsFieldno longer keeps its own
copy, but instead provides a property that wraps the one in the widget.
This ensures there's only ever one version of
to be managed per field per form instance, and that it's always unique
to that instance.
Unit tests pass.
Verified this fixed a bug I was hitting in Review Board unit tests.