Function
_fk_getter
(
self: Model, _key: str, ftype: type[Model], relation_field: str, to_field: str
)
Source from the content-addressed store, hash-verified
| 103 | |
| 104 | |
| 105 | def _fk_getter( |
| 106 | self: Model, _key: str, ftype: type[Model], relation_field: str, to_field: str |
| 107 | ) -> Awaitable: |
| 108 | try: |
| 109 | return getattr(self, _key) |
| 110 | except AttributeError: |
| 111 | value = getattr(self, relation_field) |
| 112 | if value is not None: |
| 113 | return ftype.filter(**{to_field: value}).first() |
| 114 | return NoneAwaitable |
| 115 | |
| 116 | |
| 117 | def _rfk_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…