Skip to content

Commit d97fef4

Browse files
berkaykrcsvlandeg
andauthored
📝 Fix ambiguous phrasing regarding HeroPublicWithTeam model (#1678)
* docs: Fix ambiguous phrasing regarding HeroPublicWithTeam model * apply suggestion from Yurii --------- Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com> Co-authored-by: svlandeg <svlandeg@github.com>
1 parent 2ae8adb commit d97fef4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/tutorial/fastapi/relationships.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ Then we do the same for the `TeamPublicWithHeroes`, it **inherits** from `TeamPu
146146

147147
### Data Models Without Relationship Attributes
148148

149-
Now, notice that these new fields `team` and `heroes` are not declared with `Relationship()`, because these are not **table models**, they cannot have **relationship attributes** with the magic access to get that data from the database.
149+
Now, notice that these new fields `team` and `heroes` are not declared with `Relationship()`, because `HeroPublicWithTeam` and `TeamPublicWithHeroes` are not **table models**, they cannot have **relationship attributes** with the magic access to get that data from the database.
150150

151151
Instead, here these are only **data models** that will tell FastAPI **which attributes** to get data from and **which data** to get from them.
152152

153153
### Reference to Other Models
154154

155-
Also, notice that the field `team` is not declared with this new `TeamPublicWithHeroes`, because that would again create that infinite recursion of data. Instead, we declare it with the normal `TeamPublic` model.
155+
Also, notice that in the `HeroPublicWithTeam` model, the field `team` is not declared with this new `TeamPublicWithHeroes`, because that would again create that infinite recursion of data. Instead, we declare it with the normal `TeamPublic` model.
156156

157157
And the same for `TeamPublicWithHeroes`, the model used for the new field `heroes` uses `HeroPublic` to get only each hero's data.
158158

0 commit comments

Comments
 (0)