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.

Diff Revision 10

This is not the most recent revision of the diff. The latest diff is revision 16. See what's changed.

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

Commits

First Last Summary ID Author
initial modifications to list edit widget
7c5aea1b0b7622ad5965b72c7e0b9f649eef63eb Michelle
modified html classes and names
7ed90eb1f579fd4b2d96566aef69dbab98424ff1 Michelle
create listeditfield
8c5a5e698f733d5e974367f9c85d2f436353873c Michelle
create listeditdictionaryfield
8d377e93fc24ccd29beac106c037d4facd825b2e Michelle
add tests for listEditField
2df3771437170564840a4c768e49bedca3881606 Michelle
add listEditDictionary tests and some typo fixes
6a3248027c7207c6eab7fa6a9d4fccf51d1a9a91 Michelle
fixed flake8 issues
aa46cef736df948002f411c0457144bc224102c5 Michelle
add get_context and value_from_datadict methods
530d3a8a4a14d1ca488fbfb2cee37ea69fc59713 Michelle
working on javascript logic for dynamically adding and removing values in lis...
c61d3014fab76685f6e13b2bcdc1bcbd3ef52c44 Michelle
kinda working but need to fix getting proper index for data-list-index and names
fbafa58ad53cdbd50741ad5989e5724f8b989f74 Michelle
done logic for adding and removing values in listeditwidget
715daf675db9d544ef76bf432b3b7f81c5431b62 Michelle
address issues from review request
bf85d33b56b87f2f5186fe4c5508f78126d81bf6 Michelle
handle old behavior of rejoining values into a string
4e8cc1c71e3c4435878036373b7900d0cc70ffa1 Michelle
applied review request feedback
cb83b214f746bcff67214a847e213091490b03b1 Michelle
done testing and small improvements
31e17c1f3f5a05dd41b3d965526af549827a6ae2 Michelle
djblets/forms/fields.py
djblets/forms/widgets.py
djblets/forms/templates/djblets_forms/list_edit_widget.html
djblets/forms/tests/test_list_edit_dictionary_field.py
djblets/forms/tests/test_list_edit_field.py
djblets/forms/tests/test_list_edit_widget.py
djblets/static/djblets/js/forms/views/listEditView.es6.js
djblets/static/djblets/js/forms/views/tests/listEditViewTests.es6.js
Loading...