Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 38 for model_dump (0.05 sec)

  1. docs/en/docs/tutorial/extra-models.md

    As in the example above we got `user_dict` from `user_in.model_dump()`, this code:
    
    ```Python
    user_dict = user_in.model_dump()
    UserInDB(**user_dict)
    ```
    
    would be equivalent to:
    
    ```Python
    UserInDB(**user_in.model_dump())
    ```
    
    ...because `user_in.model_dump()` is a `dict`, and then we make Python "unpack" it by passing it to `UserInDB` prefixed with `**`.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 6.9K bytes
    - Viewed (0)
  2. docs/es/docs/tutorial/body-updates.md

    Como `item.model_dump(exclude_unset=True)`.
    
    /// info | Información
    
    En Pydantic v1 el método se llamaba `.dict()`, fue deprecado (pero aún soportado) en Pydantic v2, y renombrado a `.model_dump()`.
    
    Los ejemplos aquí usan `.dict()` para compatibilidad con Pydantic v1, pero deberías usar `.model_dump()` si puedes usar Pydantic v2.
    
    ///
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 16:33:45 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  3. docs/de/docs/tutorial/body-updates.md

    ///
    
    ### Pydantics `exclude_unset`-Parameter verwenden { #using-pydantics-exclude-unset-parameter }
    
    Wenn Sie Teil-Aktualisierungen entgegennehmen, ist der `exclude_unset`-Parameter in der `.model_dump()`-Methode von Pydantic-Modellen sehr nützlich.
    
    Wie in `item.model_dump(exclude_unset=True)`.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 24 10:28:19 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  4. docs_src/body/tutorial003_py310.py

        price: float
        tax: float | None = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 330 bytes
    - Viewed (0)
  5. docs_src/body/tutorial003_py39.py

        price: float
        tax: Union[float, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 368 bytes
    - Viewed (0)
  6. docs_src/extra_models/tutorial002_py310.py

    def fake_password_hasher(raw_password: str):
        return "supersecret" + raw_password
    
    
    def fake_save_user(user_in: UserIn):
        hashed_password = fake_password_hasher(user_in.password)
        user_in_db = UserInDB(**user_in.model_dump(), hashed_password=hashed_password)
        print("User saved! ..not really")
        return user_in_db
    
    
    @app.post("/user/", response_model=UserOut)
    async def create_user(user_in: UserIn):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 798 bytes
    - Viewed (0)
  7. docs_src/extra_models/tutorial002_py39.py

    def fake_password_hasher(raw_password: str):
        return "supersecret" + raw_password
    
    
    def fake_save_user(user_in: UserIn):
        hashed_password = fake_password_hasher(user_in.password)
        user_in_db = UserInDB(**user_in.model_dump(), hashed_password=hashed_password)
        print("User saved! ..not really")
        return user_in_db
    
    
    @app.post("/user/", response_model=UserOut)
    async def create_user(user_in: UserIn):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 830 bytes
    - Viewed (0)
  8. docs_src/body_updates/tutorial002_py39.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.model_dump(exclude_unset=True)
        updated_item = stored_item_model.model_copy(update=update_data)
        items[item_id] = jsonable_encoder(updated_item)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 1K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/extra-models.md

    Da wir im obigen Beispiel `user_dict` von `user_in.model_dump()` bekommen haben, wäre dieser Code:
    
    ```Python
    user_dict = user_in.model_dump()
    UserInDB(**user_dict)
    ```
    
    gleichwertig zu:
    
    ```Python
    UserInDB(**user_in.model_dump())
    ```
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 24 10:28:19 UTC 2025
    - 8K bytes
    - Viewed (0)
  10. docs_src/body_updates/tutorial002_py310.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.model_dump(exclude_unset=True)
        updated_item = stored_item_model.model_copy(update=update_data)
        items[item_id] = jsonable_encoder(updated_item)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 1022 bytes
    - Viewed (0)
Back to top