Changes between Initial Version and Version 1 of Ticket #36507
- Timestamp:
- Jul 14, 2025, 5:38:59 PM (7 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36507 – Description
initial v1 1 When using QuerySet.union() in Django, any prefetch_related()applied to the second (and third, etc) queryset is silently ignored. See [https://forum.djangoproject.com/t/using-union-with-querysets-that-have-a-custom-prefetch-object/41638 forum thread in which it was suggested to open a documentation ticket]. A docs improvement should also likely include the workaround for using `Q` objects to do all prefetches in the base qs (where possible), which is suggested by Simon in the forum.1 When using QuerySet.union() (possibly also `intersection()` and `difference()`) in Django, any `prefetch_related()` applied to the second (and third, etc) queryset is silently ignored. See [https://forum.djangoproject.com/t/using-union-with-querysets-that-have-a-custom-prefetch-object/41638 forum thread in which it was suggested to open a documentation ticket]. A docs improvement should also likely include the workaround for using `Q` objects to do all prefetches in the base qs (where possible), which is suggested by Simon in the forum.