- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 41 for excludes (0.14 sec)
-
docs/zh/docs/tutorial/response-model.md
!!! info 你还可以使用: * `response_model_exclude_defaults=True` * `response_model_exclude_none=True` 参考 <a href="https://docs.pydantic.dev/latest/concepts/serialization/#modeldict" class="external-link" target="_blank">Pydantic 文档</a> 中对 `exclude_defaults` 和 `exclude_none` 的描述。 #### 默认值字段有实际值的数据
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 7.9K bytes - Viewed (0) -
docs/ja/docs/tutorial/response-model.md
!!! info "情報" 以下も使用することができます: * `response_model_exclude_defaults=True` * `response_model_exclude_none=True`
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.3K bytes - Viewed (0) -
docs/zh/docs/tutorial/body-updates.md
`PATCH` 没有 `PUT` 知名,也怎么不常用。 很多人甚至只用 `PUT` 实现部分更新。 **FastAPI** 对此没有任何限制,可以**随意**互换使用这两种操作。 但本指南也会分别介绍这两种操作各自的用途。 ### 使用 Pydantic 的 `exclude_unset` 参数 更新部分数据时,可以在 Pydantic 模型的 `.dict()` 中使用 `exclude_unset` 参数。 比如,`item.dict(exclude_unset=True)`。 这段代码生成的 `dict` 只包含创建 `item` 模型时显式设置的数据,而不包括默认值。 然后再用它生成一个只含已设置(在请求中所发送)数据,且省略了默认值的 `dict`: ```Python hl_lines="34"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 3.6K bytes - Viewed (0) -
docs_src/response_model/tutorial004.py
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 633 bytes - Viewed (0) -
docs_src/response_model/tutorial006.py
response_model_include=["name", "description"], ) async def read_item_name(item_id: str): return items[item_id] @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"]) async def read_item_public_data(item_id: str):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 848 bytes - Viewed (0) -
docs/en/docs/advanced/dataclasses.md
{!../../../docs_src/dataclasses/tutorial003.py!} ``` 1. We still import `field` from standard `dataclasses`. 2. `pydantic.dataclasses` is a drop-in replacement for `dataclasses`. 3. The `Author` dataclass includes a list of `Item` dataclasses. 4. The `Author` dataclass is used as the `response_model` parameter. 5. You can use other standard type annotations with dataclasses as the request body.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 4.1K bytes - Viewed (0) -
docs/en/docs/advanced/middleware.md
``` `app.add_middleware()` receives a middleware class as the first argument and any additional arguments to be passed to the middleware. ## Integrated middlewares **FastAPI** includes several middlewares for common use cases, we'll see next how to use them. !!! note "Technical Details" For the next examples, you could also use `from starlette.middleware.something import SomethingMiddleware`.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 10 18:27:10 GMT 2023 - 4K bytes - Viewed (0) -
docs/en/docs/deployment/versions.md
Different versions of **FastAPI** will use a specific newer version of Starlette. So, you can just let **FastAPI** use the correct Starlette version. ## About Pydantic Pydantic includes the tests for **FastAPI** with its own tests, so new versions of Pydantic (above `1.0.0`) are always compatible with FastAPI. You can pin Pydantic to any version above `1.0.0` that works for you and below `2.0.0`. For example:
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Nov 05 20:50:37 GMT 2020 - 3.3K bytes - Viewed (0) -
docs_src/response_model/tutorial004_py310.py
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 595 bytes - Viewed (0) -
docs_src/body_updates/tutorial002.py
@app.patch("/items/{item_id}", response_model=Item) async def update_item(item_id: str, item: Item): stored_item_data = items[item_id] stored_item_model = Item(**stored_item_data) update_data = item.dict(exclude_unset=True) updated_item = stored_item_model.copy(update=update_data) items[item_id] = jsonable_encoder(updated_item)
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 1K bytes - Viewed (0)