File tree Expand file tree Collapse file tree 1 file changed +2
-70
lines changed Expand file tree Collapse file tree 1 file changed +2
-70
lines changed Original file line number Diff line number Diff line change @@ -37,83 +37,15 @@ Now we'll see how to **update** those connections between rows tables.
3737
3838We will continue with the code we used to create some heroes, and we'll update them.
3939
40- /// details | 👀 Full file preview
41-
42- //// tab | Python 3.10+
43-
44- ``` Python
45- {!./ docs_src/ tutorial/ connect/ insert/ tutorial001_py310.py!}
46- ```
47-
48- ////
49-
50- //// tab | Python 3.7+
51-
52- ``` Python
53- {!./ docs_src/ tutorial/ connect/ insert/ tutorial001.py!}
54- ```
55-
56- ////
57-
58- ///
40+ {* ./docs_src/tutorial/connect/insert/tutorial001_py310.py * }
5941
6042## Assign a Team to a Hero
6143
6244Let's say that ** Tommy Sharp** uses his "rich uncle" charms to recruit ** Spider-Boy** to join the team of the ** Preventers** , now we need to update our Spider-Boy hero object to connect it to the Preventers team.
6345
6446Doing it is just like updating any other field:
6547
66- //// tab | Python 3.10+
67-
68- ``` Python hl_lines="8"
69- # Code above omitted 👆
70-
71- {!./ docs_src/ tutorial/ connect/ update/ tutorial001_py310.py[ln:29 - 30 ]!}
72-
73- # Previous code here omitted 👈
74-
75- {!./ docs_src/ tutorial/ connect/ update/ tutorial001_py310.py[ln:60 - 64 ]!}
76-
77- # Code below omitted 👇
78- ```
79-
80- ////
81-
82- //// tab | Python 3.7+
83-
84- ``` Python hl_lines="8"
85- # Code above omitted 👆
86-
87- {!./ docs_src/ tutorial/ connect/ update/ tutorial001.py[ln:31 - 32 ]!}
88-
89- # Previous code here omitted 👈
90-
91- {!./ docs_src/ tutorial/ connect/ update/ tutorial001.py[ln:62 - 66 ]!}
92-
93- # Code below omitted 👇
94- ```
95-
96- ////
97-
98- /// details | 👀 Full file preview
99-
100- //// tab | Python 3.10+
101-
102- ``` Python
103- {!./ docs_src/ tutorial/ connect/ update/ tutorial001_py310.py!}
104- ```
105-
106- ////
107-
108- //// tab | Python 3.7+
109-
110- ``` Python
111- {!./ docs_src/ tutorial/ connect/ update/ tutorial001.py!}
112- ```
113-
114- ////
115-
116- ///
48+ {* ./docs_src/tutorial/connect/update/tutorial001_py310.py ln[ 29:30] hl[ 8] * }
11749
11850We can simply ** assign** a value to that field attribute ` team_id ` , then ` add() ` the hero to the session, and then ` commit() ` .
11951
You can’t perform that action at this time.
0 commit comments