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 toConditionChoice
instances (for request state or anything
else) was getting shared across multipleConditionsField
s for multiple
instances of the same form. The reason is that thechoice_kwargs
wasn't being copied whenForm
creates instance-specific copies of its
declared form fields.We now perform the copy, but in the widget (which previously shared
ConditionsField
's version).ConditionsField
no 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 ofchoice_kwargs
that has
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.