From 4f9b2ea9eb8a283c7bbf21c43025fd022f744c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sun, 27 Oct 2024 09:08:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Update=20includes=20for=20`docs/?= =?UTF-8?q?advanced/uuid.md`=20(#1151)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/advanced/uuid.md | 172 +----------------------------------------- 1 file changed, 4 insertions(+), 168 deletions(-) diff --git a/docs/advanced/uuid.md b/docs/advanced/uuid.md index 5649263..abfcfed 100644 --- a/docs/advanced/uuid.md +++ b/docs/advanced/uuid.md @@ -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 `UUID` types. @@ -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. 🚀