tortoise / tortoise/tortoise-orm
Base class fields of Model are None
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the inheritance example in the linked models tutorial and reproduce the issue using the reported Python 3.10.0 and Tortoise ORM 0.19.1 versions. Trace how fields from TimestampMixin are loaded when retrieving the child model; done means created_at and modified_at are populated instead of None.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100