Add a form for working with key/value stores instead of models.

Review Request #7853 — Created Jan. 7, 2016 and submitted — Latest diff uploaded

Information

Djblets
release-0.10.x

Reviewers

Forms generally are bound to models, or are completely custom and devoid
of any real default logic beyond rendering and validation. We have some
forms in Djblets that interface with models or other objects, treating
them like key/value stores using set and get methods. These are
all based on SiteSettingsForm, which is built for SiteConfiguration,
and isn't always the best model to use.

This change introduces a new form, KeyValueForm, which works as a base
for all these other forms, SiteSettingsForm included. It handles the
loading of data from an object, the saving of form data back out to
the object, and load/save blacklists for fields (a feature used by
these other forms). It also handles easily marking some fields as
disabled, another feature used by these other forms.

It's built to be usable with any type of key/value storage backend,
by providing several functions that can be overridden to handle the
getting and setting of keys and their values and the creation/saving
of instances.

Unit tests pass in both Djblets and Review Board.

Manually tested configuring extensions and saving the various site
settings forms.