tortoise-orm
tortoise-orm copied to clipboard
fix #1462, add field_type for TimeDeltaField
Description
fix https://github.com/tortoise/tortoise-orm/issues/1462
Motivation and Context
use pydantic_model_creator with fields.TimeDeltaField in 0.19.3 will get error
pydantic.error_wrappers.ValidationError: 1 validation error for DemoSchema
usage_time
value is not None (type=type_error.not_none)
How Has This Been Tested?
https://github.com/tortoise/tortoise-orm/assets/8170059/fa70fa98-0ebe-4c97-80da-2537ce0ac724
python3.9 pydantic 1.10.12 tortoise-orm 0.19.3
tortoise/fields/data.py:501
Checklist:
- [yes ] My code follows the code style of this project.
- [no] My change requires a change to the documentation.
- [no] I have updated the documentation accordingly.
- [no] I have added the changelog accordingly.
- [yes ] I have read the CONTRIBUTING document.
- [no ] I have added tests to cover my changes.
- [no ] All new and existing tests passed.
Please add testcase reproducing issue to tests/contrib/test_pydantic.py
Bump. Having the same issue, the PR solution fixed it.