Here the `get_prefetch_queryset` method is passed
`lookup.get_current_querysets(level)` - which returns a list of querysets
- as the `queryset` argument, which expects a single queryset. Changing
this to `lookup.get_current_queryset(level)` fixes the problem (although
it also doubles up the deprecation warnings, which may not be ideal).
Unfortunately I'm slightly stumped over how I might create a regression
test for this - presumably this would involve writing a minimal related
manager class that implements `get_current_queryset` but not
`get_current_querysets`, but since this is an internal API it's hard to
know what's considered minimal while still being a legal implementation.
If it's any help, I encountered this as a regression to the `django-
modelcluster` package: https://github.com/wagtail/django-
modelcluster/actions/runs/6407673311/job/17394971115
--
Ticket URL: <https://code.djangoproject.com/ticket/34889>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Clément Escolano (added)
* stage: Unreviewed => Accepted
Comment:
Great catch! I think we should still call `get_current_querysets()`, but
pass only the first one when a return value is not `None`.
Regression in cac94dd8aa2fb49cd2e06b5b37cf039257284bb0.
--
Ticket URL: <https://code.djangoproject.com/ticket/34889#comment:1>
* owner: nobody => Mariusz Felisiak
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/34889#comment:2>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/17343 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/34889#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"296b75a3c0309a936a6c07d8f711f722e3b96e63" 296b75a]:
{{{
#!CommitTicketReference repository=""
revision="296b75a3c0309a936a6c07d8f711f722e3b96e63"
Fixed #34889 -- Fixed get_prefetch_queryset() fallback in
prefetch_one_level().
Thanks Matt Westcott for the report.
Regression in cac94dd8aa2fb49cd2e06b5b37cf039257284bb0.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34889#comment:4>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"9f8bf7aebe1d389aa06f41bcaccf5c4418c71026" 9f8bf7ae]:
{{{
#!CommitTicketReference repository=""
revision="9f8bf7aebe1d389aa06f41bcaccf5c4418c71026"
[5.0.x] Fixed #34889 -- Fixed get_prefetch_queryset() fallback in
prefetch_one_level().
Thanks Matt Westcott for the report.
Regression in cac94dd8aa2fb49cd2e06b5b37cf039257284bb0.
Backport of 296b75a3c0309a936a6c07d8f711f722e3b96e63 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34889#comment:5>