Changes between Initial Version and Version 1 of Ticket #37027, comment 1


Ignore:
Timestamp:
Apr 9, 2026, 8:27:13 AM (8 hours ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37027, comment 1

    initial v1  
    33When we added `refresh_from_db(from_queryset)` support (#28344) we knew it would open the door to a large surface area between `Model` and `QuerySet` APIs. Given the original intent was to support `for_update` and friends I'm not convinced we should add support for `prefetch_related` and certainly not for `Prefetch(to_attr)` as it doesn't follow the `refresh_from_db(fields)` convention.
    44
    5 Support for `select_related` came for free as it's a normal attribute lookup on the retrieved model instance and there are real benefits to using it (reducing the number of queries). In the case of `prefetch_related` it requires extra retrieval and invalidation logic of many-to-many relationships and results in the same number of queries.
     5Support for `select_related` came for free as it's a normal attribute lookup on the retrieved model instance and there are real benefits to using it (reducing the number of queries). In the case of `prefetch_related` it requires extra retrieval and invalidation logic of many-to-many relationships and results in the same number of queries. I believe accepting this work would open the door to supporting the full `Model` X `QuerySet` intersection which would include cases like `annotate` members being ignored as well.
Back to Top