• 
      

    Avoid double-patching querysets in LocalSiteAwareModelFormMixin.

    Review Request #10482 — Created March 31, 2019 and submitted

    Information

    Review Board
    release-4.0.x

    Reviewers

    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
    like SELECT ... 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
    Avoid double-patching querysets in LocalSiteAwareModelFormMixin.
    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 like `SELECT ... 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.
    7997dc6f77652f914ff250af4a42f231916341c4
    Description From Last Updated

    F811 redefinition of unused 'test_post_all_repositories_not_same_local_site' from line 132

    reviewbotreviewbot
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.0.x (4b79377)