Harsh N. Haria 1 day ago
committed by GitHub
parent
commit
bf1e59fec1
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      docs_src/body/tutorial002.py
  2. 2
      docs_src/body/tutorial002_py310.py
  3. 2
      docs_src/body/tutorial003.py
  4. 2
      docs_src/body/tutorial003_py310.py
  5. 2
      docs_src/body/tutorial004.py
  6. 2
      docs_src/body/tutorial004_py310.py

2
docs_src/body/tutorial002.py

@ -16,7 +16,7 @@ app = FastAPI()
@app.post("/items/")
async def create_item(item: Item):
item_dict = item.dict()
item_dict = item.model_dump()
if item.tax is not None:
price_with_tax = item.price + item.tax
item_dict.update({"price_with_tax": price_with_tax})

2
docs_src/body/tutorial002_py310.py

@ -14,7 +14,7 @@ app = FastAPI()
@app.post("/items/")
async def create_item(item: Item):
item_dict = item.dict()
item_dict = item.model_dump()
if item.tax is not None:
price_with_tax = item.price + item.tax
item_dict.update({"price_with_tax": price_with_tax})

2
docs_src/body/tutorial003.py

@ -16,4 +16,4 @@ app = FastAPI()
@app.put("/items/{item_id}")
async def update_item(item_id: int, item: Item):
return {"item_id": item_id, **item.dict()}
return {"item_id": item_id, **item.model_dump()}

2
docs_src/body/tutorial003_py310.py

@ -14,4 +14,4 @@ app = FastAPI()
@app.put("/items/{item_id}")
async def update_item(item_id: int, item: Item):
return {"item_id": item_id, **item.dict()}
return {"item_id": item_id, **item.model_dump()}

2
docs_src/body/tutorial004.py

@ -16,7 +16,7 @@ app = FastAPI()
@app.put("/items/{item_id}")
async def update_item(item_id: int, item: Item, q: Union[str, None] = None):
result = {"item_id": item_id, **item.dict()}
result = {"item_id": item_id, **item.model_dump()}
if q:
result.update({"q": q})
return result

2
docs_src/body/tutorial004_py310.py

@ -14,7 +14,7 @@ app = FastAPI()
@app.put("/items/{item_id}")
async def update_item(item_id: int, item: Item, q: str | None = None):
result = {"item_id": item_id, **item.dict()}
result = {"item_id": item_id, **item.model_dump()}
if q:
result.update({"q": q})
return result

Loading…
Cancel
Save