Skip to content

Commit a2cda83

Browse files
📝 Update docs for models for updating, id should not be updatable (#335)
Co-authored-by: Sebastián Ramírez <[email protected]>
1 parent 8ac82e7 commit a2cda83

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

docs/tutorial/fastapi/relationships.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ And the same way, we declared the `TeamRead` with only the same base fields of t
5555

5656
# Code here omitted 👈
5757

58-
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:32-37]!}
58+
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:31-36]!}
5959

6060
# Code here omitted 👈
6161

62-
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:46-47]!}
62+
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:45-46]!}
6363

6464
# Code below omitted 👇
6565
```
@@ -80,11 +80,11 @@ In this case, we used `response_model=TeamRead` and `response_model=HeroRead`, s
8080
```Python hl_lines="3 8 12 17"
8181
# Code above omitted 👆
8282

83-
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:105-110]!}
83+
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:104-109]!}
8484

8585
# Code here omitted 👈
8686

87-
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:160-165]!}
87+
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:159-164]!}
8888

8989
# Code below omitted 👇
9090
```

docs/tutorial/fastapi/teams.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Then we also inherit from the `TeamBase` for the `TeamCreate` and `TeamRead` **d
1818

1919
And we also create a `TeamUpdate` **data model**.
2020

21-
```Python hl_lines="7-9 12-15 18-19 22-23 26-29"
22-
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:1-29]!}
21+
```Python hl_lines="7-9 12-15 18-19 22-23 26-28"
22+
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:1-28]!}
2323

2424
# Code below omitted 👇
2525
```
@@ -42,7 +42,7 @@ Let's now update the `Hero` models too.
4242
```Python hl_lines="3-8 11-15 17-18 21-22 25-29"
4343
# Code above omitted 👆
4444

45-
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:32-58]!}
45+
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:31-57]!}
4646

4747
# Code below omitted 👇
4848
```
@@ -66,10 +66,10 @@ And even though the `HeroBase` is *not* a **table model**, we can declare `team_
6666

6767
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.
6868

69-
```Python hl_lines="11 39"
69+
```Python hl_lines="11 38"
7070
# Code above omitted 👆
7171

72-
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:7-58]!}
72+
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:7-57]!}
7373

7474
# Code below omitted 👇
7575
```
@@ -92,7 +92,7 @@ These are equivalent and very similar to the **path operations** for the **heroe
9292
```Python hl_lines="3-9 12-20 23-28 31-47 50-57"
9393
# Code above omitted 👆
9494

95-
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:140-194]!}
95+
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:139-193]!}
9696

9797
# Code below omitted 👇
9898
```

docs_src/tutorial/fastapi/teams/tutorial001.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class TeamRead(TeamBase):
2424

2525

2626
class TeamUpdate(SQLModel):
27-
id: Optional[int] = None
2827
name: Optional[str] = None
2928
headquarters: Optional[str] = None
3029

tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@
442442
"title": "TeamUpdate",
443443
"type": "object",
444444
"properties": {
445-
"id": {"title": "Id", "type": "integer"},
446445
"name": {"title": "Name", "type": "string"},
447446
"headquarters": {"title": "Headquarters", "type": "string"},
448447
},

0 commit comments

Comments
 (0)