#32281: Prefetech Object - to_attr has ambiguous behavior when using a related
lookup
-------------------------------------+-------------------------------------
Reporter: Tal Perry | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tal Perry):
* status: closed => new
* resolution: wontfix =>
Comment:
I understand that we can't assign to the main object, but am reopening
because I think significant confusion remains.
In our use case, we're assigning a filtered queryset to the prefetch
object .
{{{
annotations = Prefetch(
"tokens__tagged_tokens", queryset=tagged_token_qs,
to_attr="annotations",
)
}}}
In the above example it's not clear whether the resulting prefetch will
bring all tokens, or only those tokens who have a tagged_token in the
supplied queryset.
Perhaps the solution is as simple as making this explicit in the docs.
Happy to contribute if that's the right way and someone can shed light on
the behavior and any edge cases.
--
Ticket URL: <https://code.djangoproject.com/ticket/32281#comment:2>
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/066.7e9f35d3974f2bbda8cf2c0a42440cb6%40djangoproject.com.