From bdcf11bca62889710678913e7fc7ae30e067d0ae Mon Sep 17 00:00:00 2001 From: Jorge Alvarado Date: Sun, 22 Oct 2023 09:03:51 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Update=20instructions=20about=20?= =?UTF-8?q?how=20to=20make=20a=20foreign=20key=20required=20in=20`docs/tut?= =?UTF-8?q?orial/relationship-attributes/define-relationships-attributes.m?= =?UTF-8?q?d`=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastián Ramírez --- .../define-relationships-attributes.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/tutorial/relationship-attributes/define-relationships-attributes.md b/docs/tutorial/relationship-attributes/define-relationships-attributes.md index 0531ec5..b6e77d9 100644 --- a/docs/tutorial/relationship-attributes/define-relationships-attributes.md +++ b/docs/tutorial/relationship-attributes/define-relationships-attributes.md @@ -115,9 +115,7 @@ This means that this attribute could be `None`, or it could be a full `Team` obj This is because the related **`team_id` could also be `None`** (or `NULL` in the database). -If it was required for a `Hero` instance to belong to a `Team`, then the `team_id` would be `int` instead of `Optional[int]`. - -And the `team` attribute would be a `Team` instead of `Optional[Team]`. +If it was required for a `Hero` instance to belong to a `Team`, then the `team_id` would be `int` instead of `Optional[int]`, its `Field` would be `Field(foreign_key="team.id")` instead of `Field(default=None, foreign_key="team.id")` and the `team` attribute would be a `Team` instead of `Optional[Team]`. ## Relationship Attributes With Lists