Skip to content

Instantly share code, notes, and snippets.

@hamaguchi-amago
Last active July 12, 2021 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamaguchi-amago/9af393b287fb50aeaaed1d4d79daa5dd to your computer and use it in GitHub Desktop.
Save hamaguchi-amago/9af393b287fb50aeaaed1d4d79daa5dd to your computer and use it in GitHub Desktop.
【FastAPI】チェックボックスの値取得方法
from fastapi import (
APIRouter,
Form,
)
router = APIRouter()
@router.post("/")
async def function(
checkbox: bool = Form(False),
):
print(checkbox)
<div class="form-check">
<input class="form-check-input" id="test" name="checkbox"
type="checkbox" value="True">
<label class="form-check-label" for="test">チェックボックス</label>
</div>
@hamaguchi-amago
Copy link
Author

ブログの記事で作成しました。
興味のある方はご覧ください。

【FastAPI】チェックボックスの値の取得方法
https://neko-py.com/fastapi-checkbox-value-get

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment