#32089: prefetch_related_objects() does not set the to_attr on all instances if
the
first instance in the list already has it.
-------------------------------------+-------------------------------------
Reporter: Dennis Kliban | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 2.2
(models, ORM) |
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by François Freitag):
> Our project processes instances in a stream.
Could you give more details on that? `prefetch_related_objects()` loads
all objects upfront due to
https://github.com/django/django/blob/stable/2.2.x/django/db/models/query.py#L1546.
Even with an overloaded `__bool__`, the `QuerySet` is iterated over by
https://github.com/django/django/blob/stable/2.2.x/django/db/models/query.py#L1585.
--
Ticket URL: <https://code.djangoproject.com/ticket/32089#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.cd2c04d1686aff8c27798aba8af156d5%40djangoproject.com.