tortoise-orm icon indicating copy to clipboard operation
tortoise-orm copied to clipboard

Fix one of the models TODOs

Open waketzheng opened this issue 8 months ago • 2 comments

Description

  • fixes one TODO mark in tortoise/models.py about Model._init_from_db
    1. Refactor the logic of execute_select function in executor who using several _init_from_db
    2. Refactor generate logic of db_native_fields/db_default_fields/db_complex_fields, they were used in _init_from_db
    3. Use inited_keys set to avoid set attr twice
    4. Add key not in meta.fields_map check, this may fix the #1665
  • fixes mypy complaints for tortoise/queryset.py after remove all the type: ignore in it

Motivation and Context

fix TODO and improve type hint

How Has This Been Tested?

make ci

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added the changelog accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

waketzheng avatar Jun 28 '24 15:06 waketzheng