Set initial repository subform values to fix PUTs via the API.
Review Request #10960 — Created March 20, 2020 and submitted
RepositoryFormdoes a lot of work to build and populate subforms, but
it wasn't complete. While the main
RepositoryForminitial data was
populated by way of the parent
ModelForm, the relevant subforms never
had their own initial data set, nor did they necessarily have the right
form data set from an existing instance.
This regressed the API. Performing an HTTP PUT on the repository
resource would error out unless
provided, since those model-level attributes never transitioned properly
to the subforms. We didn't have suitable test coverage for this, so it
wasn't noticed before
This change updates active subforms for an existing instance to have
their initial data for these model-level fields set properly. It also
improves the test suite just a bit to better catch some of this and to
leverage the built-in tests for PUT requests. More work still needs to
be done to better flesh out these tests, which will be handled in a
All unit tests pass.