#35376: Prefetched data not used when combining prefetch_related() and only()
-------------------------------------+-------------------------------------
Reporter: Michael Schwarz | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
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 Simon Charette):
* cc: Simon Charette (added)
Comment:
I think there might more to it here given `Building.restaurant` is a
reverse one-to-one and thus there is no field stored on `Restaurant` to
reference it and thus no field to ''defer''.
If `.city` was used in the test then it would have been a duplicate of
#33835 (and
[https://github.com/django/django/blob/47c608202a58c8120d049c98d5d27c4609551d33/tests/defer/tests.py#L315-L329
something we could warn about] like we do with `select_related` + `only`
misuse) as using `prefetch_related("city")` requires that `"city_id"` is
included in the select mask (include in `only` and excluded from
`exclude`) but here it looks like something different.
--
Ticket URL: <https://code.djangoproject.com/ticket/35376#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/0107018ee2f4e81e-ac645534-2c0c-483a-aac9-0783c69e4c64-000000%40eu-central-1.amazonses.com.