Add a mixin for updating models with a ModelForm
Add a mixin for updating models with a ModelForm

The `UpdateFormMixin` is a mixin for a `WebAPIResource` that allows a
resource to specify a form class (which should be a subclass of
`django.forms.ModelForm`) to use for creating and updating of model
instances. This allows the resource that are very basic wrappers around
models to have their logic further simplified.

This mixin is required for allowing partial updating of models.
Traditionally, a `ModelForm` can take an `instance` parameter
specifying an already existing model instance to update, but will still
require *all* required field to specified in the form data. This mixin
takes care of that by extracting missing form data from the instance
and inserting it into the form data in the proper format (such as
setting it to be a list of primary keys in the case of a
`ModelMultipleChoiceField`).

This mixin also allows resources to specify special functions for
parsing values out of the recieved form data. This is useful, e.g., for
automatically converting human-readable values accepted by the API to
the value the database expects for a `ChoiceField`.

This is a re-export of the mixin from Djblets with some extra
functionality added.

Testing Done:
Used the mixin in a model. It worked as expected.

Reviewed at https://reviews.reviewboard.org/r/7493/

reviewboard/reviewboard,brennie/reviewboard,reviewboard/reviewboard,bkochendorfer/reviewboard,brennie/reviewboard,KnowNo/reviewboard,chipx86/reviewboard,beol/reviewboard,reviewboard/reviewboard,chipx86/reviewboard,sgallagher/reviewboard,KnowNo/reviewboard,sgallagher/reviewboard,sgallagher/reviewboard,davidt/reviewboard,reviewboard/reviewboard,KnowNo/reviewboard,bkochendorfer/reviewboard,chipx86/reviewboard,sgallagher/reviewboard,beol/reviewboard,brennie/reviewboard,chipx86/reviewboard,beol/reviewboard,bkochendorfer/reviewboard,davidt/reviewboard,bkochendorfer/reviewboard,davidt/reviewboard,KnowNo/reviewboard,brennie/reviewboard,davidt/reviewboard,beol/reviewboard