Browse Source

Merge 472506507c into 1d434dec47

pull/13410/merge
eqsdxr 3 days ago
committed by GitHub
parent
commit
b59bb02713
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      docs/en/docs/tutorial/body-updates.md

8
docs/en/docs/tutorial/body-updates.md

@ -64,6 +64,14 @@ Then you can use this to generate a `dict` with only the data that was set (sent
{* ../../docs_src/body_updates/tutorial002_py310.py hl[32] *}
/// note
Notice that setting a value to `null` in a request does not omit the field; it explicitly assigns `null` to a field (which FastAPI converts to `None` in Python) and is not considered "unset."
To omit a field, simply exclude it from the request payload.
///
### Using Pydantic's `update` parameter
Now, you can create a copy of the existing model using `.model_copy()`, and pass the `update` parameter with a `dict` containing the data to update.

Loading…
Cancel
Save