Allow ListEditWidget to properly handle data when the widget is not rendered

Review Request #12346 — Created June 9, 2022 and submitted — Latest diff uploaded

Information

Djblets
release-3.x

Reviewers

When retrieving the value of a field from a submitted form, ListEditWidget
relies on certain special keys to be present in the form's data in order to
retrieve the value for the field. These keys are properly set when the widget is
rendered, but are not set in scenarios where the widget is not rendered (such as
in an API call posting to a form that uses this widget, or in test cases where a
form object is built without being rendered). This change allows
ListEditWidget to properly retrieve the value of a field even when the special
keys are missing.

This change also adds a deprecation warning for when the legacy behavior is used
(passing a string to the widget instead of a list). This change also prevents
the ListEdit fields from raising a ValueError when being passed null values.

  • Ran Unit tests for ListEditWidget, ListEditField and
    ListEditDictionaryField.
  • Ran all Javascript Unit tests.

Commits

Files