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

Respect PydanticMeta::backward_relations #536

Merged
merged 4 commits into from
Dec 19, 2020

Conversation

Hummer12007
Copy link
Contributor

@Hummer12007 Hummer12007 commented Oct 29, 2020

Description

Implemented backward_relations for PydanticMeta: if it is set to False, fields of backward relationships will not be added to the Pydantic model.

Motivation and Context

Specifying backward_relations has no effect with current versions of tortoise, even though it is mentioned in the docs.

How Has This Been Tested?

Ran make test in the testing environment, will later add tests covering this feature.

Checklist:

  • 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 read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1872

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 96.813%

Totals Coverage Status
Change from base Build 1868: -0.01%
Covered Lines: 4221
Relevant Lines: 4312

💛 - Coveralls

@coveralls
Copy link

coveralls commented Oct 29, 2020

Pull Request Test Coverage Report for Build 432743649

  • 15 of 15 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.007%) to 96.355%

Totals Coverage Status
Change from base Build 431938944: 0.007%
Covered Lines: 4288
Relevant Lines: 4398

💛 - Coveralls

@lqmanh
Copy link
Contributor

lqmanh commented Nov 19, 2020

I hope this can be merged soon. It will solve my issue #510.

@lqmanh
Copy link
Contributor

lqmanh commented Dec 18, 2020

@grigi, @long2ice, @abondar
Please consider reviewing this PR, we really need this feature.

Thanks in advance!

Copy link
Member

@abondar abondar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but also need documentation changes

And please write down changes to CHANGELOG
Also you could add yourself to contributors file

tortoise/contrib/pydantic/creator.py Outdated Show resolved Hide resolved
@abondar
Copy link
Member

abondar commented Dec 18, 2020

Ran make test in the testing environment, will later add tests covering this feature.

Also implementing tests would be nice

@Hummer12007
Copy link
Contributor Author

Thanks!
I'll give it a shot during the weekend.

@Hummer12007
Copy link
Contributor Author

Hummer12007 commented Dec 19, 2020

Implemented tests, updated CHANGELOG, added myself to CONTRIBUTORS.

The class is mostly undocumented so I left docs as is.

@Hummer12007
Copy link
Contributor Author

@abondar I think I've done everything.

@abondar abondar merged commit 656ecad into tortoise:develop Dec 19, 2020
@Hummer12007
Copy link
Contributor Author

Thanks!

@abondar
Copy link
Member

abondar commented Dec 23, 2020

@Hummer12007 released as 0.16.19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants