@@ -8,101 +8,13 @@ We'll create data for this same **many-to-many** relationship with a link table:
88
99We'll continue from where we left off with the previous code.
1010
11- /// details | 👀 Full file preview
12-
13- //// tab | Python 3.10+
14-
15- ``` Python
16- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py310.py!}
17- ```
18-
19- ////
20-
21- //// tab | Python 3.9+
22-
23- ``` Python
24- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py39.py!}
25- ```
26-
27- ////
28-
29- //// tab | Python 3.7+
30-
31- ``` Python
32- {!./ docs_src/ tutorial/ many_to_many/ tutorial001.py!}
33- ```
34-
35- ////
36-
37- ///
11+ {* ./docs_src/tutorial/many_to_many/tutorial001_py310.py * }
3812
3913## Create Heroes
4014
4115As we have done before, we'll create a function ` create_heroes() ` and we'll create some teams and heroes in it:
4216
43- //// tab | Python 3.10+
44-
45- ``` Python hl_lines="11"
46- # Code above omitted 👆
47-
48- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py310.py[ln:36 - 54 ]!}
49-
50- # Code below omitted 👇
51- ```
52-
53- ////
54-
55- //// tab | Python 3.9+
56-
57- ``` Python hl_lines="11"
58- # Code above omitted 👆
59-
60- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py39.py[ln:42 - 60 ]!}
61-
62- # Code below omitted 👇
63- ```
64-
65- ////
66-
67- //// tab | Python 3.7+
68-
69- ``` Python hl_lines="11"
70- # Code above omitted 👆
71-
72- {!./ docs_src/ tutorial/ many_to_many/ tutorial001.py[ln:42 - 60 ]!}
73-
74- # Code below omitted 👇
75- ```
76-
77- ////
78-
79- /// details | 👀 Full file preview
80-
81- //// tab | Python 3.10+
82-
83- ``` Python
84- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py310.py!}
85- ```
86-
87- ////
88-
89- //// tab | Python 3.9+
90-
91- ``` Python
92- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py39.py!}
93- ```
94-
95- ////
96-
97- //// tab | Python 3.7+
98-
99- ``` Python
100- {!./ docs_src/ tutorial/ many_to_many/ tutorial001.py!}
101- ```
102-
103- ////
104-
105- ///
17+ {* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[ 36:54] hl[ 11] * }
10618
10719This is very similar to what we have done before.
10820
@@ -116,137 +28,13 @@ See how **Deadpond** now belongs to the two teams?
11628
11729Now let's do as we have done before, ` commit ` the ** session** , ` refresh ` the data, and print it:
11830
119- //// tab | Python 3.10+
120-
121- ``` Python hl_lines="22-25 27-29 31-36"
122- # Code above omitted 👆
123-
124- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py310.py[ln:36 - 69 ]!}
125-
126- # Code below omitted 👇
127- ```
128-
129- ////
130-
131- //// tab | Python 3.9+
132-
133- ``` Python hl_lines="22-25 27-29 31-36"
134- # Code above omitted 👆
135-
136- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py39.py[ln:42 - 75 ]!}
137-
138- # Code below omitted 👇
139- ```
140-
141- ////
142-
143- //// tab | Python 3.7+
144-
145- ``` Python hl_lines="22-25 27-29 31-36"
146- # Code above omitted 👆
147-
148- {!./ docs_src/ tutorial/ many_to_many/ tutorial001.py[ln:42 - 75 ]!}
149-
150- # Code below omitted 👇
151- ```
152-
153- ////
154-
155- /// details | 👀 Full file preview
156-
157- //// tab | Python 3.10+
158-
159- ``` Python
160- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py310.py!}
161- ```
162-
163- ////
164-
165- //// tab | Python 3.9+
166-
167- ``` Python
168- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py39.py!}
169- ```
170-
171- ////
172-
173- //// tab | Python 3.7+
174-
175- ``` Python
176- {!./ docs_src/ tutorial/ many_to_many/ tutorial001.py!}
177- ```
178-
179- ////
180-
181- ///
31+ {* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[ 36:69] hl[ 22:25,27:29,31:36] * }
18232
18333## Add to Main
18434
18535As before, add the ` create_heroes() ` function to the ` main() ` function to make sure it is called when running this program from the command line:
18636
187- //// tab | Python 3.10+
188-
189- ``` Python
190- # Code above omitted 👆
191-
192- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py310.py[ln:72 - 74 ]!}
193-
194- # Code below omitted 👇
195- ```
196-
197- ////
198-
199- //// tab | Python 3.9+
200-
201- ``` Python
202- # Code above omitted 👆
203-
204- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py39.py[ln:78 - 80 ]!}
205-
206- # Code below omitted 👇
207- ```
208-
209- ////
210-
211- //// tab | Python 3.7+
212-
213- ``` Python
214- # Code above omitted 👆
215-
216- {!./ docs_src/ tutorial/ many_to_many/ tutorial001.py[ln:78 - 80 ]!}
217-
218- # Code below omitted 👇
219- ```
220-
221- ////
222-
223- /// details | 👀 Full file preview
224-
225- //// tab | Python 3.10+
226-
227- ``` Python
228- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py310.py!}
229- ```
230-
231- ////
232-
233- //// tab | Python 3.9+
234-
235- ``` Python
236- {!./ docs_src/ tutorial/ many_to_many/ tutorial001_py39.py!}
237- ```
238-
239- ////
240-
241- //// tab | Python 3.7+
242-
243- ``` Python
244- {!./ docs_src/ tutorial/ many_to_many/ tutorial001.py!}
245- ```
246-
247- ////
248-
249- ///
37+ {* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[ 72:74] * }
25038
25139## Run the Program
25240
0 commit comments