Modify djblets.forms.widgets.ListEditWidget to handle any type of widget and form field

Review Request #11858 — Created Oct. 20, 2021 and submitted — Latest diff uploaded

Information

Djblets
release-3.x

Reviewers

Previously, ListEditWidget expects values to be strings with a valid
separator, thus it can only be used to edit a list of strings.
The corresponding Django template and Backbone view are hardcoded to
display string values with text inputs.

This change modifies ListEditWidget so that it can modify a list of
any type of values, not just strings. This change includes the creation
of a ListEditField which has the ListEditWidget as its default widget.
This field splits a string into a list of strings, reproducing the
behaviour of the old ListEditWidget. We also introduce a
ListEditDictionaryField, which takes a dictionary and splits it into a
list of (key, value) tuples.

  • Wrote tests for ListEditField and ListEditDictionaryField. Ran all
    tests in djblets.forms.tests with success.
  • Updated tests for ListEditWidget and ListEditView. Ran all Javascript Unit
    tests with success.
  • Performed manual tests.

Changes between revision 12 and 13

orig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Commits

Summary ID Author
fixed merge conflicts and added updates for
reviewboard5.0
9e21d68a1b619b24677805db8628a8b388c45d98 Michelle
fixed merge conflicts and added updates for
reviewboard5.0
195d3f4f3cdcfeeea72757443c19e38c6488738a Michelle
djblets/forms/widgets.py
djblets/forms/tests/test_list_edit_dictionary_field.py
djblets/forms/tests/test_list_edit_field.py
Loading...