From 28c3039f3edf8a004f08aecf1315fd5d74108655 Mon Sep 17 00:00:00 2001 From: Alissa Date: Sun, 27 Oct 2024 17:31:31 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Update=20includes=20for=20`docs/?= =?UTF-8?q?tutorial/fastapi/teams.md`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/tutorial/fastapi/teams.md | 250 +-------------------------------- 1 file changed, 4 insertions(+), 246 deletions(-) diff --git a/docs/tutorial/fastapi/teams.md b/docs/tutorial/fastapi/teams.md index 9e366f2cc2..2abbef1a8d 100644 --- a/docs/tutorial/fastapi/teams.md +++ b/docs/tutorial/fastapi/teams.md @@ -18,63 +18,7 @@ Then we also inherit from the `TeamBase` for the `TeamCreate` and `TeamPublic` * And we also create a `TeamUpdate` **data model**. -//// tab | Python 3.10+ - -```Python hl_lines="5-7 10-13 16-17 20-21 24-26" -{!./docs_src/tutorial/fastapi/teams/tutorial001_py310.py[ln:1-26]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.9+ - -```Python hl_lines="7-9 12-15 18-19 22-23 26-28" -{!./docs_src/tutorial/fastapi/teams/tutorial001_py39.py[ln:1-28]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.7+ - -```Python hl_lines="7-9 12-15 18-19 22-23 26-28" -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:1-28]!} - -# Code below omitted 👇 -``` - -//// - -/// details | 👀 Full file preview - -//// tab | Python 3.10+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001_py310.py!} -``` - -//// - -//// tab | Python 3.9+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001_py39.py!} -``` - -//// - -//// tab | Python 3.7+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} -``` - -//// - -/// +{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[1:26] hl[5:7,10:13,16:17,20:21,24:26] *} We now also have **relationship attributes**. 🎉 @@ -82,69 +26,7 @@ Let's now update the `Hero` models too. ## Update Hero Models -//// tab | Python 3.10+ - -```Python hl_lines="3-8 11-14 17-18 21-22 25-29" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001_py310.py[ln:29-55]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.9+ - -```Python hl_lines="3-8 11-14 17-18 21-22 25-29" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001_py39.py[ln:31-57]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.7+ - -```Python hl_lines="3-8 11-14 17-18 21-22 25-29" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:31-57]!} - -# Code below omitted 👇 -``` - -//// - -/// details | 👀 Full file preview - -//// tab | Python 3.10+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001_py310.py!} -``` - -//// - -//// tab | Python 3.9+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001_py39.py!} -``` - -//// - -//// tab | Python 3.7+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} -``` - -//// - -/// +{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[29:55] hl[3:8,11:14,17:18,21:22,25:29] *} We now have a `team_id` in the hero models. @@ -156,69 +38,7 @@ And even though the `HeroBase` is *not* a **table model**, we can declare `team_ Notice that the **relationship attributes**, the ones with `Relationship()`, are **only** in the **table models**, as those are the ones that are handled by **SQLModel** with SQLAlchemy and that can have the automatic fetching of data from the database when we access them. -//// tab | Python 3.10+ - -```Python hl_lines="11 38" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001_py310.py[ln:5-55]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.9+ - -```Python hl_lines="11 38" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001_py39.py[ln:7-57]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.7+ - -```Python hl_lines="11 38" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:7-57]!} - -# Code below omitted 👇 -``` - -//// - -/// details | 👀 Full file preview - -//// tab | Python 3.10+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001_py310.py!} -``` - -//// - -//// tab | Python 3.9+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001_py39.py!} -``` - -//// - -//// tab | Python 3.7+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} -``` - -//// - -/// +{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[5:55] hl[11,38] *} ## Path Operations for Teams @@ -226,69 +46,7 @@ Let's now add the **path operations** for teams. These are equivalent and very similar to the **path operations** for the **heroes** we had before, so we don't have to go over the details for each one, let's check the code. -//// tab | Python 3.10+ - -```Python hl_lines="3-9 12-20 23-28 31-47 50-57" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001_py310.py[ln:136-190]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.9+ - -```Python hl_lines="3-9 12-20 23-28 31-47 50-57" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001_py39.py[ln:138-192]!} - -# Code below omitted 👇 -``` - -//// - -//// tab | Python 3.7+ - -```Python hl_lines="3-9 12-20 23-28 31-47 50-57" -# Code above omitted 👆 - -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:138-192]!} - -# Code below omitted 👇 -``` - -//// - -/// details | 👀 Full file preview - -//// tab | Python 3.10+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001_py310.py!} -``` - -//// - -//// tab | Python 3.9+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001_py39.py!} -``` - -//// - -//// tab | Python 3.7+ - -```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} -``` - -//// - -/// +{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[136:190] hl[3:9,12:20,23:28,31:47,50:57] *} ## Using Relationships Attributes