Add more flexible form and field spport in LocalSiteAwareModelFormMixin.
Review Request #10409 — Created Feb. 15, 2019 and submitted
LocalSiteAwareModelFormMixinhas been updated to work with a wider
variety of forms. Specifically, those that take in a
parameter, which previously was not being passed in to the parent form.
Since there's no reliable way to introspect whether the parent requires
this parameter, and since the mixin itself needs it, we now have a flag
that the form can set to specify it needs this parameter. This will be
required for the
IntegrationConfigFormin a future change.
This also improves the field support.
ConditionFields are now
supported, and will have their
LocalSiteset in order to limit valid
results to those on the selected site. On top of this, the logic for
overriding and then restoring the queryset on fields has been expanded
to do the same with the
local_site_nameattribute on a field's
RelatedUserWidget, ensuring everything is back to normal after
validation if not limiting the form to a
Unit tests pass, both as of this change and with the upcoming work to
IntegrationConfigFormover to this mixin.
Manually tested the forms with this mixin.