Add more flexible form and field spport in LocalSiteAwareModelFormMixin.

Review Request #10409 — Created Feb. 15, 2019 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x
4713c21...

Reviewers

LocalSiteAwareModelFormMixin has been updated to work with a wider
variety of forms. Specifically, those that take in a request
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 IntegrationConfigForm in a future change.

This also improves the field support. ConditionFields are now
supported, and will have their LocalSite set 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_name attribute on a field's
RelatedUserWidget, ensuring everything is back to normal after
validation if not limiting the form to a LocalSite.

Unit tests pass, both as of this change and with the upcoming work to
move IntegrationConfigForm over to this mixin.

Manually tested the forms with this mixin.

    Loading...