fields.py
64.2 KB
-
Allow `ChoiceField.choices` to be set dynamically (#5426) · c0a48622
## Description The `choices` field for the `ChoiceField` class should be able to be edited after `ChoiceField.__init__` is called. ``` field = ChoiceField(choices=[1,2]) field.choices = [1] # Should no longer allow `2` as a choice ``` Currently, you must update `choices`, `grouped_choices`, and `choice_strings_to_values` to achieve this. This P/R keeps `grouped_choices` and `choice_strings_to_values` in sync whenever the `choices` are edited.
Jeremy Nauta committed