Changes between Version 1 and Version 2 of Ticket #36372, comment 3


Ignore:
Timestamp:
May 9, 2025, 4:22:07 PM (4 months ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36372, comment 3

    v1 v2  
    33In in case the reverse field name on `Article` is named `item` and its query name and descriptor name is `item_set`. The changes implemented in #29625 failed to account for the fact that the related query name, which is used for the prefetched key namespace, might differ from the field name for reverse relationships.
    44
    5 If an explicit `related_name` is defined (e.g. `items`) then both match and calling `refresh_from_db(fields=["items"])` doesn't crash with and without the prior `prefetch_related("items")` call (albeit it performs an unnecessary query of the form `SELECT id FROM container WHERE container = ?`).
     5If an explicit `related_name` is defined (e.g. `items`) then both match and calling `refresh_from_db(fields=["items"])` doesn't crash with and without the prior `prefetch_related("items")` call (albeit it performs an unnecessary query of the form `SELECT id FROM container WHERE container = ?` is performed when not prefefetched).
    66
    77Changing `ForeignObjectRel.name` to default to `.accessor_name` is tempting here but that would likely break tons of things.
Back to Top