Changes between Version 3 and Version 4 of Ticket #35442, comment 6
- Timestamp:
- May 10, 2024, 6:01:42 PM (7 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35442, comment 6
v3 v4 43 43 # Add the known related objects to the model. 44 44 - for field, rel_objs, rel_getter in known_related_objects: 45 + for field, rel_objs, attnames, rel_getter in known_related_objects:45 + for field, rel_objs, rel_attnames, rel_getter in known_related_objects: 46 46 # Avoid overwriting objects loaded by, e.g., select_related(). 47 47 if field.is_cached(obj): … … 49 49 + # Avoid fetching potentially deferred attributes that would 50 50 + # result in unexpected queries. 51 + if any(attname not in obj.__dict__ for attname in attnames):51 + if any(attname not in obj.__dict__ for attname in rel_attnames): 52 52 + continue 53 53 rel_obj_id = rel_getter(obj)