Set initial repository subform values to fix PUTs via the API.
Review Request #10960 — Created March 20, 2020 and submitted
RepositoryForm
does a lot of work to build and populate subforms, but
it wasn't complete. While the mainRepositoryForm
initial data was
populated by way of the parentModelForm
, 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 unlessname
andpath
were explicitly
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 beforeThis 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
separate change.
All unit tests pass.
Summary | ID |
---|---|
17e1aab6525c2a728e0520a0cb91c3b30ab971ad |