Avoid double-patching querysets in LocalSiteAwareModelFormMixin.
Review Request #10482 — Created March 31, 2019 and submitted
The mixin for ensuring Local Site restrictions for forms was
double-patching querysets when limiting to a Local Site. The first patch
would happen at form construction time, and the second would happen at
form cleaning time (though this one was temporary). This caused queries
likeSELECT ... WHERE local_site_id=1 AND local_site_id=1
.This change fixes that to only patch during form cleaning if it hasn't
already patched at form construction.It also updates the field accesses to work with newer versions of
Django, and splits a unit test for these restrictions into two to avoid
an ordering difference on the newer versions.
Unit tests pass on Django 1.6 and 1.11 (with other in-progress changes).
Summary | ID |
---|---|
7997dc6f77652f914ff250af4a42f231916341c4 |
Description | From | Last Updated |
---|---|---|
F811 redefinition of unused 'test_post_all_repositories_not_same_local_site' from line 132 |
reviewbot |