Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for _model_dump (0.31 sec)

  1. fastapi/encoders.py

    from pydantic.networks import AnyUrl, NameEmail
    from pydantic.types import SecretBytes, SecretStr
    from typing_extensions import Annotated, Doc
    
    from ._compat import PYDANTIC_V2, UndefinedType, Url, _model_dump
    
    
    # Taken from Pydantic v1 as is
    def isoformat(o: Union[datetime.date, datetime.time]) -> str:
        return o.isoformat()
    
    
    # Taken from Pydantic v1 as is
    # TODO: pv2 should this return strings instead?
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 21:56:59 UTC 2024
    - 10.8K bytes
    - Viewed (0)
  2. fastapi/_compat.py

        def _model_rebuild(model: Type[BaseModel]) -> None:
            model.model_rebuild()
    
        def _model_dump(
            model: BaseModel, mode: Literal["json", "python"] = "json", **kwargs: Any
        ) -> Any:
            return model.model_dump(mode=mode, **kwargs)
    
        def _get_model_config(model: BaseModel) -> Any:
            return model.model_config
    
        def get_schema_from_model_field(
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Oct 12 09:36:32 UTC 2024
    - 23.4K bytes
    - Viewed (0)
  3. fastapi/routing.py

        Optional,
        Sequence,
        Set,
        Tuple,
        Type,
        Union,
    )
    
    from fastapi import params
    from fastapi._compat import (
        ModelField,
        Undefined,
        _get_model_config,
        _model_dump,
        _normalize_errors,
        lenient_issubclass,
    )
    from fastapi.datastructures import Default, DefaultPlaceholder
    from fastapi.dependencies.models import Dependant
    from fastapi.dependencies.utils import (
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Oct 12 09:44:57 UTC 2024
    - 172.1K bytes
    - Viewed (0)
  4. docs/de/docs/tutorial/body-updates.md

    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)`.
    
    /// info
    
    In Pydantic v1 hieß diese Methode `.dict()`, in Pydantic v2 wurde sie deprecated (aber immer noch unterstützt) und in `.model_dump()` umbenannt.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  5. docs/pt/docs/tutorial/body-updates.md

    Como `item.model_dump(exclude_unset=True)`.
    
    /// info | Informação
    
    No Pydantic v1, o método que era chamado `.dict()` e foi depreciado (mas ainda suportado) no Pydantic v2. Agora, deve-se usar o método `.model_dump()`.
    
    Os exemplos aqui usam `.dict()` para compatibilidade com o Pydantic v1, mas você deve usar `.model_dump()` a partir do Pydantic v2.
    
    ///
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Oct 14 09:16:06 UTC 2024
    - 6K bytes
    - Viewed (0)
  6. docs/en/docs/tutorial/body-updates.md

    Like `item.model_dump(exclude_unset=True)`.
    
    /// info
    
    In Pydantic v1 the method was called `.dict()`, it was deprecated (but still supported) in Pydantic v2, and renamed to `.model_dump()`.
    
    The examples here use `.dict()` for compatibility with Pydantic v1, but you should use `.model_dump()` instead if you can use Pydantic v2.
    
    ///
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  7. docs_src/sql_databases/tutorial002_py310.py

    ):
        hero_db = session.get(Hero, hero_id)
        if not hero_db:
            raise HTTPException(status_code=404, detail="Hero not found")
        hero_data = hero.model_dump(exclude_unset=True)
        hero_db.sqlmodel_update(hero_data)
        session.add(hero_db)
        session.commit()
        session.refresh(hero_db)
        return hero_db
    
    
    @app.delete("/heroes/{hero_id}")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/extra-models.md

    ```
    
    ////
    
    /// info
    
    In Pydantic v1 the method was called `.dict()`, it was deprecated (but still supported) in Pydantic v2, and renamed to `.model_dump()`.
    
    The examples here use `.dict()` for compatibility with Pydantic v1, but you should use `.model_dump()` instead if you can use Pydantic v2.
    
    ///
    
    ### About `**user_in.dict()`
    
    #### Pydantic's `.dict()`
    
    `user_in` is a Pydantic model of class `UserIn`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  9. docs_src/sql_databases/tutorial002.py

    ):
        hero_db = session.get(Hero, hero_id)
        if not hero_db:
            raise HTTPException(status_code=404, detail="Hero not found")
        hero_data = hero.model_dump(exclude_unset=True)
        hero_db.sqlmodel_update(hero_data)
        session.add(hero_db)
        session.commit()
        session.refresh(hero_db)
        return hero_db
    
    
    @app.delete("/heroes/{hero_id}")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  10. docs_src/sql_databases/tutorial002_an_py310.py

    def update_hero(hero_id: int, hero: HeroUpdate, session: SessionDep):
        hero_db = session.get(Hero, hero_id)
        if not hero_db:
            raise HTTPException(status_code=404, detail="Hero not found")
        hero_data = hero.model_dump(exclude_unset=True)
        hero_db.sqlmodel_update(hero_data)
        session.add(hero_db)
        session.commit()
        session.refresh(hero_db)
        return hero_db
    
    
    @app.delete("/heroes/{hero_id}")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.5K bytes
    - Viewed (0)
Back to top