3
0
Fork 0

docs: add comment regarding association proxy for dict(obj)

This commit is contained in:
Lance Edgar 2026-02-15 14:12:37 -06:00
parent 7734ee3b75
commit fb1a7b22d8

View file

@ -56,6 +56,7 @@ class ModelBase: # pylint: disable=empty-docstring
def __iter__(self):
# nb. we override this to allow for `dict(self)`
# nb. this does *not* include association proxy values
state = sa.inspect(self)
fields = [attr.key for attr in state.attrs]
return iter([(field, getattr(self, field)) for field in fields])