Update DataGrid.load_extra_state to return lists of modified fields.
Review Request #12315 — Created May 31, 2022 and submitted — Latest diff uploaded
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 ofFalse
before).DataGrid
will take the list and
pass it tosave(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.