#34178: Prefetching a foreign key on GenericForeignKey results in incorrect
queryset being selected
-------------------------------------+-------------------------------------
Reporter: Rohan Nahata | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: GenericForeignKey, | Triage Stage:
prefetch_related | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* type: Bug => New feature
* resolution: => duplicate
Comment:
`QuerySet.prefetch_related()` works with `GenericForeignKey`, however it
is only supported if the query is restricted to one `ContentType` (see
`prefetch_related()`
[https://docs.djangoproject.com/en/stable/ref/models/querysets/#prefetch-
related docs]).
Duplicate of #33651.
--
Ticket URL: <https://code.djangoproject.com/ticket/34178#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/010701849f7bb186-6c2477f1-7e3e-4e68-9996-6326339b1263-000000%40eu-central-1.amazonses.com.