📝 Update details syntax with new pymdown extensions format (#713)

This commit is contained in:
Sebastián Ramírez
2023-11-28 23:12:33 +01:00
committed by GitHub
parent be464fba69
commit 799d0aa7a6
37 changed files with 409 additions and 614 deletions

View File

@@ -30,14 +30,13 @@ So, let's create this new `HeroUpdate` model:
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/update/tutorial001.py!}
```
</details>
///
This is almost the same as `HeroBase`, but all the fields are optional, so we can't simply inherit from `HeroBase`.
@@ -55,14 +54,13 @@ We will use a `PATCH` HTTP operation. This is used to **partially update data**,
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/update/tutorial001.py!}
```
</details>
///
We also read the `hero_id` from the *path parameter* and the request body, a `HeroUpdate`.
@@ -80,14 +78,13 @@ So, we need to read the hero from the database, with the **same logic** we used
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/update/tutorial001.py!}
```
</details>
///
### Get the New Data
@@ -147,14 +144,13 @@ Then we use that to get the data that was actually sent by the client:
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/update/tutorial001.py!}
```
</details>
///
## Update the Hero in the Database
@@ -168,14 +164,13 @@ Now that we have a **dictionary with the data sent by the client**, we can itera
# Code below omitted 👇
```
<details>
<summary>👀 Full file preview</summary>
/// details | 👀 Full file preview
```Python
{!./docs_src/tutorial/fastapi/update/tutorial001.py!}
```
</details>
///
If you are not familiar with that `setattr()`, it takes an object, like the `db_hero`, then an attribute name (`key`), that in our case could be `"name"`, and a value (`value`). And then it **sets the attribute with that name to the value**.