Add more flexible form and field spport in LocalSiteAwareModelFormMixin.

Review Request #1670 — Created June 7, 2019 and updated

guest2012
Review Board
309f02f...
guest2012
`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. `ConditionField`s 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`.

Testing Done:
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.

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


Loading file attachments...

Description From Last Updated

Test issue

guest2012guest2012
Loading...