Function
_ro2o_getter
(
self: Model, _key: str, ftype: type[Model], frelfield: str, from_field: str
)
Source from the content-addressed store, hash-verified
| 125 | |
| 126 | |
| 127 | def _ro2o_getter( |
| 128 | self: Model, _key: str, ftype: type[Model], frelfield: str, from_field: str |
| 129 | ) -> QuerySetSingle[Model | None]: |
| 130 | if hasattr(self, _key): |
| 131 | return getattr(self, _key) |
| 132 | |
| 133 | val = ftype.filter(**{frelfield: getattr(self, from_field)}).first() |
| 134 | setattr(self, _key, val) |
| 135 | return val |
| 136 | |
| 137 | |
| 138 | def _m2m_getter( |
Callers
nothing calls this directly
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…