-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Labels
Description
- Since Re-prefetch related objects after updating #8043,
UpdateModelMixin.update()
accesses the queryset's_prefetch_related_lookups
attribute. - Manager objects don't have this attribute.
- This causes an exception when the queryset is, e.g., a
RelatedManager
:def get_queryset(self): return self.user.somerelated_set
Notes:
get_queryset()
is not expected to return aQuerySet
. This is explicitly stated inget_queryset()
's docstring.- In fact, that docstring implies that there is no expectation that there is a
_prefetch_related_lookups
attribute. - My particular instance of the problem could be fixed on the application side by adding
.all()
. However, that would cause early evaluation of the queryset before filtering. That's not an option; SQL queries should run only once all WHERE conditions have been applied.
This is a regression that simply breaks stuff that has been working with the stable API. The change should be reverted.
(This is similar to #9306, but not the same.)
francesco-filicetti and mrzorn