Changes between Version 1 and Version 2 of Ticket #36372, comment 3
- Timestamp:
- May 9, 2025, 4:22:07 PM (4 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #36372, comment 3
v1 v2 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 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 = ?` ).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 = ?` is performed when not prefefetched). 6 6 7 7 Changing `ForeignObjectRel.name` to default to `.accessor_name` is tempting here but that would likely break tons of things.