1
0
mirror of https://github.com/django/django.git synced 2025-03-06 15:32:33 +00:00
Simon Charette 8aea6b802c [5.2.x] Fixed #35677 -- Avoided non-sticky filtering of prefetched many-to-many.
The original queryset._next_is_sticky() call never had the intended effect as
no further filtering was applied internally after the pk__in lookup making it
a noop.

In order to be coherent with how related filters are applied when retrieving
objects from a related manager the effects of what calling _next_is_sticky()
prior to applying annotations and filters to the queryset provided for
prefetching are emulated by allowing the reuse of all pre-existing JOINs.

Thanks David Glenck and Thiago Bellini Ribeiro for the detailed reports and
tests.

Backport of 2598b371a93e21d84b7a2a99b2329535c8c0c138 from main.
2025-02-06 14:31:32 +01:00
..
2024-11-11 14:47:04 +01:00
2024-01-26 12:45:07 +01:00

To run the test suite, first, create and activate a virtual environment. Then
install some requirements and run the tests::

    $ cd tests
    $ python -m pip install -e ..
    $ python -m pip install -r requirements/py3.txt
    $ ./runtests.py

For more information about the test suite, see
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/.