Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1462, add field_type for TimeDeltaField #1463

Closed
wants to merge 1 commit into from

Conversation

yinkh
Copy link

@yinkh yinkh commented Aug 23, 2023

Description

fix #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?

2023-08-23.17-47-04.mp4

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.

@abondar
Copy link
Member

abondar commented Apr 27, 2024

Please add testcase reproducing issue to tests/contrib/test_pydantic.py

@DavideGalilei
Copy link

Bump. Having the same issue, the PR solution fixed it.

@abondar
Copy link
Member

abondar commented Aug 23, 2024

Did same chages in #1699 to run them through tests, not sure when it will be released

@abondar abondar closed this Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants