]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
πŸ“ Update includes for `docs/advanced/uuid.md` (#1151)
authorSebastiΓ‘n RamΓ­rez <tiangolo@gmail.com>
Sun, 27 Oct 2024 08:08:30 +0000 (09:08 +0100)
committerGitHub <noreply@github.com>
Sun, 27 Oct 2024 08:08:30 +0000 (08:08 +0000)
docs/advanced/uuid.md

index 56492636f6f817e42001492beb0bab3342821e9a..abfcfeda2b07811c43d4c95553d11d8102c6ad77 100644 (file)
@@ -80,45 +80,7 @@ We don't call `uuid.uuid4()` ourselves in the code (we don't put the parenthesis
 
 This means that the UUID will be generated in the Python code, **before sending the data to the database**.
 
-//// tab | Python 3.10+
-
-```Python hl_lines="1  7"
-{!./docs_src/advanced/uuid/tutorial001_py310.py[ln:1-10]!}
-
-# Code below omitted πŸ‘‡
-```
-
-////
-
-//// tab | Python 3.7+
-
-```Python hl_lines="1  8"
-{!./docs_src/advanced/uuid/tutorial001.py[ln:1-11]!}
-
-# Code below omitted πŸ‘‡
-```
-
-////
-
-/// details | πŸ‘€ Full file preview
-
-//// tab | Python 3.10+
-
-```Python
-{!./docs_src/advanced/uuid/tutorial001_py310.py!}
-```
-
-////
-
-//// tab | Python 3.7+
-
-```Python
-{!./docs_src/advanced/uuid/tutorial001.py!}
-```
-
-////
-
-///
+{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[1:10] hl[1,7] *}
 
 Pydantic has support for <a href="https://docs.pydantic.dev/latest/api/standard_library_types/#uuid" class="external-link" target="_blank">`UUID` types</a>.
 
@@ -132,49 +94,7 @@ As `uuid.uuid4` will be called when creating the model instance, even before sen
 
 And that **same ID (a UUID)** will be saved in the database.
 
-//// tab | Python 3.10+
-
-```Python hl_lines="5  7  9  14"
-# Code above omitted πŸ‘†
-
-{!./docs_src/advanced/uuid/tutorial001_py310.py[ln:23-34]!}
-
-# Code below omitted πŸ‘‡
-```
-
-////
-
-//// tab | Python 3.7+
-
-```Python hl_lines="5  7  9  14"
-# Code above omitted πŸ‘†
-
-{!./docs_src/advanced/uuid/tutorial001.py[ln:24-35]!}
-
-# Code below omitted πŸ‘‡
-```
-
-////
-
-/// details | πŸ‘€ Full file preview
-
-//// tab | Python 3.10+
-
-```Python
-{!./docs_src/advanced/uuid/tutorial001_py310.py!}
-```
-
-////
-
-//// tab | Python 3.7+
-
-```Python
-{!./docs_src/advanced/uuid/tutorial001.py!}
-```
-
-////
-
-///
+{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[23:34] hl[25,27,29,34] *}
 
 ### Select a Hero
 
@@ -182,49 +102,7 @@ We can do the same operations we could do with other fields.
 
 For example we can **select a hero by ID**:
 
-//// tab | Python 3.10+
-
-```Python hl_lines="15"
-# Code above omitted πŸ‘†
-
-{!./docs_src/advanced/uuid/tutorial001_py310.py[ln:37-54]!}
-
-# Code below omitted πŸ‘‡
-```
-
-////
-
-//// tab | Python 3.7+
-
-```Python hl_lines="15"
-# Code above omitted πŸ‘†
-
-{!./docs_src/advanced/uuid/tutorial001.py[ln:38-55]!}
-
-# Code below omitted πŸ‘‡
-```
-
-////
-
-/// details | πŸ‘€ Full file preview
-
-//// tab | Python 3.10+
-
-```Python
-{!./docs_src/advanced/uuid/tutorial001_py310.py!}
-```
-
-////
-
-//// tab | Python 3.7+
-
-```Python
-{!./docs_src/advanced/uuid/tutorial001.py!}
-```
-
-////
-
-///
+{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[37:54] hl[49] *}
 
 /// tip
 
@@ -238,49 +116,7 @@ SQLModel (actually SQLAlchemy) will take care of making it work. βœ¨
 
 We could also select by ID with `session.get()`:
 
-//// tab | Python 3.10+
-
-```Python hl_lines="15"
-# Code above omitted πŸ‘†
-
-{!./docs_src/advanced/uuid/tutorial002_py310.py[ln:37-54]!}
-
-# Code below omitted πŸ‘‡
-```
-
-////
-
-//// tab | Python 3.7+
-
-```Python hl_lines="15"
-# Code above omitted πŸ‘†
-
-{!./docs_src/advanced/uuid/tutorial002.py[ln:38-55]!}
-
-# Code below omitted πŸ‘‡
-```
-
-////
-
-/// details | πŸ‘€ Full file preview
-
-//// tab | Python 3.10+
-
-```Python
-{!./docs_src/advanced/uuid/tutorial002_py310.py!}
-```
-
-////
-
-//// tab | Python 3.7+
-
-```Python
-{!./docs_src/advanced/uuid/tutorial002.py!}
-```
-
-////
-
-///
+{* ./docs_src/advanced/uuid/tutorial002_py310.py ln[37:53] hl[49] *}
 
 The same way as with other fields, we could update, delete, etc. πŸš€