Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Update docs for models for updating, id should not be updatable #335

Merged
merged 4 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/tutorial/fastapi/relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ And the same way, we declared the `TeamRead` with only the same base fields of t

# Code here omitted 👈

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

# Code here omitted 👈

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

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

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

# Code here omitted 👈

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

# Code below omitted 👇
```
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorial/fastapi/teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Then we also inherit from the `TeamBase` for the `TeamCreate` and `TeamRead` **d

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

```Python hl_lines="7-9 12-15 18-19 22-23 26-29"
{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:1-29]!}
```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 👇
```
Expand All @@ -42,7 +42,7 @@ Let's now update the `Hero` models too.
```Python hl_lines="3-8 11-15 17-18 21-22 25-29"
# Code above omitted 👆

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

# Code below omitted 👇
```
Expand All @@ -66,10 +66,10 @@ 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.

```Python hl_lines="11 39"
```Python hl_lines="11 38"
# Code above omitted 👆

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

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

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

# Code below omitted 👇
```
Expand Down
1 change: 0 additions & 1 deletion docs_src/tutorial/fastapi/teams/tutorial001.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class TeamRead(TeamBase):


class TeamUpdate(SQLModel):
id: Optional[int] = None
name: Optional[str] = None
headquarters: Optional[str] = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@
"title": "TeamUpdate",
"type": "object",
"properties": {
"id": {"title": "Id", "type": "integer"},
"name": {"title": "Name", "type": "string"},
"headquarters": {"title": "Headquarters", "type": "string"},
},
Expand Down