@@ -18,133 +18,15 @@ Then we also inherit from the `TeamBase` for the `TeamCreate` and `TeamPublic` *
1818
1919And we also create a ` TeamUpdate ` ** data model** .
2020
21- //// tab | Python 3.10+
22-
23- ``` Python hl_lines="5-7 10-13 16-17 20-21 24-26"
24- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py310.py[ln:1 - 26 ]!}
25-
26- # Code below omitted 👇
27- ```
28-
29- ////
30-
31- //// tab | Python 3.9+
32-
33- ``` Python hl_lines="7-9 12-15 18-19 22-23 26-28"
34- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py39.py[ln:1 - 28 ]!}
35-
36- # Code below omitted 👇
37- ```
38-
39- ////
40-
41- //// tab | Python 3.7+
42-
43- ``` Python hl_lines="7-9 12-15 18-19 22-23 26-28"
44- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001.py[ln:1 - 28 ]!}
45-
46- # Code below omitted 👇
47- ```
48-
49- ////
50-
51- /// details | 👀 Full file preview
52-
53- //// tab | Python 3.10+
54-
55- ``` Python
56- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py310.py!}
57- ```
58-
59- ////
60-
61- //// tab | Python 3.9+
62-
63- ``` Python
64- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py39.py!}
65- ```
66-
67- ////
68-
69- //// tab | Python 3.7+
70-
71- ``` Python
72- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001.py!}
73- ```
74-
75- ////
76-
77- ///
21+ {* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[ 1:26] hl[ 5:7,10:13,16:17,20:21,24:26] * }
7822
7923We now also have ** relationship attributes** . 🎉
8024
8125Let's now update the ` Hero ` models too.
8226
8327## Update Hero Models
8428
85- //// tab | Python 3.10+
86-
87- ``` Python hl_lines="3-8 11-14 17-18 21-22 25-29"
88- # Code above omitted 👆
89-
90- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py310.py[ln:29 - 55 ]!}
91-
92- # Code below omitted 👇
93- ```
94-
95- ////
96-
97- //// tab | Python 3.9+
98-
99- ``` Python hl_lines="3-8 11-14 17-18 21-22 25-29"
100- # Code above omitted 👆
101-
102- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py39.py[ln:31 - 57 ]!}
103-
104- # Code below omitted 👇
105- ```
106-
107- ////
108-
109- //// tab | Python 3.7+
110-
111- ``` Python hl_lines="3-8 11-14 17-18 21-22 25-29"
112- # Code above omitted 👆
113-
114- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001.py[ln:31 - 57 ]!}
115-
116- # Code below omitted 👇
117- ```
118-
119- ////
120-
121- /// details | 👀 Full file preview
122-
123- //// tab | Python 3.10+
124-
125- ``` Python
126- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py310.py!}
127- ```
128-
129- ////
130-
131- //// tab | Python 3.9+
132-
133- ``` Python
134- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py39.py!}
135- ```
136-
137- ////
138-
139- //// tab | Python 3.7+
140-
141- ``` Python
142- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001.py!}
143- ```
144-
145- ////
146-
147- ///
29+ {* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[ 29:55] hl[ 29:34,37:40,43:44,47:48,51:55] * }
14830
14931We now have a ` team_id ` in the hero models.
15032
@@ -156,139 +38,15 @@ And even though the `HeroBase` is *not* a **table model**, we can declare `team_
15638
15739Notice 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.
15840
159- //// tab | Python 3.10+
160-
161- ``` Python hl_lines="11 38"
162- # Code above omitted 👆
163-
164- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py310.py[ln:5 - 55 ]!}
165-
166- # Code below omitted 👇
167- ```
168-
169- ////
170-
171- //// tab | Python 3.9+
172-
173- ``` Python hl_lines="11 38"
174- # Code above omitted 👆
175-
176- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py39.py[ln:7 - 57 ]!}
177-
178- # Code below omitted 👇
179- ```
180-
181- ////
182-
183- //// tab | Python 3.7+
184-
185- ``` Python hl_lines="11 38"
186- # Code above omitted 👆
187-
188- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001.py[ln:7 - 57 ]!}
189-
190- # Code below omitted 👇
191- ```
192-
193- ////
194-
195- /// details | 👀 Full file preview
196-
197- //// tab | Python 3.10+
198-
199- ``` Python
200- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py310.py!}
201- ```
202-
203- ////
204-
205- //// tab | Python 3.9+
206-
207- ``` Python
208- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py39.py!}
209- ```
210-
211- ////
212-
213- //// tab | Python 3.7+
214-
215- ``` Python
216- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001.py!}
217- ```
218-
219- ////
220-
221- ///
41+ {* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[ 5:55] hl[ 13,40] * }
22242
22343## Path Operations for Teams
22444
22545Let's now add the ** path operations** for teams.
22646
22747These 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.
22848
229- //// tab | Python 3.10+
230-
231- ``` Python hl_lines="3-9 12-20 23-28 31-47 50-57"
232- # Code above omitted 👆
233-
234- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py310.py[ln:136 - 190 ]!}
235-
236- # Code below omitted 👇
237- ```
238-
239- ////
240-
241- //// tab | Python 3.9+
242-
243- ``` Python hl_lines="3-9 12-20 23-28 31-47 50-57"
244- # Code above omitted 👆
245-
246- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py39.py[ln:138 - 192 ]!}
247-
248- # Code below omitted 👇
249- ```
250-
251- ////
252-
253- //// tab | Python 3.7+
254-
255- ``` Python hl_lines="3-9 12-20 23-28 31-47 50-57"
256- # Code above omitted 👆
257-
258- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001.py[ln:138 - 192 ]!}
259-
260- # Code below omitted 👇
261- ```
262-
263- ////
264-
265- /// details | 👀 Full file preview
266-
267- //// tab | Python 3.10+
268-
269- ``` Python
270- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py310.py!}
271- ```
272-
273- ////
274-
275- //// tab | Python 3.9+
276-
277- ``` Python
278- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001_py39.py!}
279- ```
280-
281- ////
282-
283- //// tab | Python 3.7+
284-
285- ``` Python
286- {!./ docs_src/ tutorial/ fastapi/ teams/ tutorial001.py!}
287- ```
288-
289- ////
290-
291- ///
49+ {* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[ 136:190] hl[ 136:142,145:153,156:161,164:180,183:190] * }
29250
29351## Using Relationships Attributes
29452
0 commit comments