Open enneamer opened 2 years ago
I can see in the source code models.py
:761
def __iter__(self):
for field in self._meta.db_fields:
yield field, getattr(self, field)
It iterates over the database fields instead of the object fields, but also tries to fetch the object attribute value instead.
I happen to have use cases for iterating over object fields (for manual dataclass mapping) and database fields (for database debugging). I wonder what is the original intention of this function, and what is the correct way for the other use case.
Describe the bug When a field specifies
source_field
,Model.__iter__()
no longer works.To Reproduce
Expected behavior This iteration sho
Additional context Python 3.10.4 tortoise-orm==0.19.0