tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.5k stars 368 forks source link

Base class fields of Model are None #1144

Open Holmes555 opened 2 years ago

Holmes555 commented 2 years ago

Describe the bug I've created models like in this tutorial https://tortoise-orm.readthedocs.io/en/latest/models.html#inheritance and trying retrieve object of child class (from example it's UserModel) but fields 'created_at' and 'modified_at' from TimestampMixin are None. But I can see in database fields are filled, so the problem is in retrieving fields for base Model.

To Reproduce https://tortoise-orm.readthedocs.io/en/latest/models.html#inheritance

Expected behavior I want to isolate some repetitive fields in separate Class not inherited from models.Model and be able to get them.

Additional context Python - 3.10.0 Tortoise ORM - 0.19.1

tinducvo commented 2 years ago

This issue took me all day to figure out. My program was working and then it didn't. Pinning version 0.19.0 fixes things for me.

gh0st-work commented 1 year ago

Pinning version 0.19.0 fixes things for me.

+

0.19.1 and 0.19.2 are broken in fields abstract inheritance