- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 333 for Models (0.05 seconds)
-
docs/en/docs/tutorial/extra-models.md
# Extra Models { #extra-models } Continuing with the previous example, it will be common to have more than one related model. This is especially the case for user models, because: * The **input model** needs to be able to have a password. * The **output model** should not have a password. * The **database model** would probably need to have a hashed password. /// dangerCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 6.7K bytes - Click Count (0) -
docs/en/docs/tutorial/query-param-models.md
# Query Parameter Models { #query-parameter-models } If you have a group of **query parameters** that are related, you can create a **Pydantic model** to declare them. This would allow you to **re-use the model** in **multiple places** and also to declare validations and metadata for all the parameters at once. 😎 /// note This is supported since FastAPI version `0.115.0`. 🤓 ///Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Aug 31 09:15:41 GMT 2025 - 2.2K bytes - Click Count (0) -
docs/en/docs/tutorial/cookie-param-models.md
# Cookie Parameter Models { #cookie-parameter-models } If you have a group of **cookies** that are related, you can create a **Pydantic model** to declare them. 🍪 This would allow you to **re-use the model** in **multiple places** and also to declare validations and metadata for all the parameters at once. 😎 /// note This is supported since FastAPI version `0.115.0`. 🤓 /// /// tipCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 10 11:48:27 GMT 2026 - 3.1K bytes - Click Count (0) -
docs/en/docs/tutorial/body-nested-models.md
## Nested Models { #nested-models } Each attribute of a Pydantic model has a type. But that type can itself be another Pydantic model. So, you can declare deeply nested JSON "objects" with specific attribute names, types and validations. All that, arbitrarily nested. ### Define a submodel { #define-a-submodel } For example, we can define an `Image` model:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 6.6K bytes - Click Count (0) -
docs/en/docs/tutorial/request-form-models.md
/// ## Pydantic Models for Forms { #pydantic-models-for-forms } You just need to declare a **Pydantic model** with the fields you want to receive as **form fields**, and then declare the parameter as `Form`: {* ../../docs_src/request_form_models/tutorial001_an_py310.py hl[9:11,15] *} **FastAPI** will **extract** the data for **each field** from the **form data** in the request and give you the Pydantic model you defined.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 2.1K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/extra-models.md
# 額外的模型 { #extra-models } 延續前一個範例,通常會有不只一個彼此相關的模型。 對使用者模型尤其如此,因為: * 「輸入模型」需要能包含密碼。 * 「輸出模型」不應包含密碼。 * 「資料庫模型」通常需要儲存雜湊後的密碼。 /// danger 切勿儲存使用者的明文密碼。務必只儲存可供驗證的「安全雜湊」。 若你還不清楚,稍後會在[安全性章節](security/simple-oauth2.md#password-hashing)學到什麼是「密碼雜湊」。 /// ## 多個模型 { #multiple-models } 以下是模型大致長相、與其密碼欄位以及它們被使用的位置: {* ../../docs_src/extra_models/tutorial001_py310.py hl[7,9,14,20,22,27:28,31:33,38:39] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 6.3K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/body-nested-models.md
# Body - 巢狀模型 { #body-nested-models } 使用 **FastAPI**,你可以定義、驗證、文件化,並使用任意深度的巢狀模型(感謝 Pydantic)。 ## 列表欄位 { #list-fields } 你可以將屬性定義為某個子型別。例如,Python 的 `list`: {* ../../docs_src/body_nested_models/tutorial001_py310.py hl[12] *} 這會讓 `tags` 成為一個列表,儘管尚未宣告列表元素的型別。 ## 具有型別參數的列表欄位 { #list-fields-with-type-parameter } 不過,Python 有一種專門的方式來宣告具有內部型別(「型別參數」)的列表: ### 宣告帶有型別參數的 `list` { #declare-a-list-with-a-type-parameter }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 6.5K bytes - Click Count (0) -
docs/zh/docs/tutorial/header-param-models.md
# Header 参数模型 { #header-parameter-models } 如果您有一组相关的 **header 参数**,您可以创建一个 **Pydantic 模型**来声明它们。 这将允许您在**多个地方**能够**重用模型**,并且可以一次性声明所有参数的验证和元数据。😎 /// note | 注意 自 FastAPI 版本 `0.115.0` 起支持此功能。🤓 /// ## 使用 Pydantic 模型的 Header 参数 { #header-parameters-with-a-pydantic-model } 在 **Pydantic 模型**中声明所需的 **header 参数**,然后将参数声明为 `Header` : {* ../../docs_src/header_param_models/tutorial001_an_py310.py hl[9:14,18] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:39:41 GMT 2026 - 2.5K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/cookie-param-models.md
# Cookie 參數模型 { #cookie-parameter-models } 如果你有一組彼此相關的「**Cookie**」,你可以建立一個「**Pydantic 模型**」來宣告它們。🍪 這樣你就能在**多處**重複使用該模型,並且能一次性為所有參數宣告**驗證**與**中繼資料**。😎 /// note | 注意 自 FastAPI 版本 `0.115.0` 起支援。🤓 /// /// tip 同樣的技巧也適用於 `Query`、`Cookie` 與 `Header`。😎 /// ## 以 Pydantic 模型宣告 Cookie { #cookies-with-a-pydantic-model } 在 **Pydantic 模型**中宣告所需的 **Cookie** 參數,接著將參數宣告為 `Cookie`:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 14 08:15:26 GMT 2026 - 2.9K bytes - Click Count (0) -
docs/en/docs/tutorial/header-param-models.md
# Header Parameter Models { #header-parameter-models } If you have a group of related **header parameters**, you can create a **Pydantic model** to declare them. This would allow you to **re-use the model** in **multiple places** and also to declare validations and metadata for all the parameters at once. 😎 /// note This is supported since FastAPI version `0.115.0`. 🤓 ///Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Aug 31 09:15:41 GMT 2025 - 2.6K bytes - Click Count (0)