Update DataGrid.load_extra_state to return lists of modified fields.

Review Request #12315 — Created May 31, 2022 and submitted


DataGrid.load_extra_state() allows a subclass to load state from a
profile into the grid, or to store data into the profile. If the
subclass makes use of profile objects, and has modifications to make, it
has historically returned a boolean value, which indicates whether the
object should be saved.

This save operation runs the risk of overriding fields set elsewhere,
since it's an all-or-nothing. That can have many side-effects.

To avoid this, load_extra_state() is now expected to return a list of
fields that were modified on the provided profile. This can be an empty
list (equivalent of False before). DataGrid will take the list and
pass it to save(update_fields=...), minimizing the changes written to
the database.

The old boolean support still exists for now, but will be removed in
Djblets 4.0.

Unit tests pass.

Made use of this in the equivalent change for Review Board.

Update DataGrid.load_extra_state to return lists of modified fields.
  1. Ship It!
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (a162c7b)