Changes between Initial Version and Version 1 of Ticket #36372, comment 3
- Timestamp:
- May 9, 2025, 4:21:44 PM (4 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36372, comment 3
initial v1 3 3 In 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. 4 4 5 If an explicit `related_name` is defined (e.g. `items`) then both match esand 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 = ?`).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 = ?`). 6 6 7 7 Changing `ForeignObjectRel.name` to default to `.accessor_name` is tempting here but that would likely break tons of things.