Last active
July 12, 2021 09:13
-
-
Save hamaguchi-amago/9af393b287fb50aeaaed1d4d79daa5dd to your computer and use it in GitHub Desktop.
【FastAPI】チェックボックスの値取得方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import ( | |
APIRouter, | |
Form, | |
) | |
router = APIRouter() | |
@router.post("/") | |
async def function( | |
checkbox: bool = Form(False), | |
): | |
print(checkbox) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ブログの記事で作成しました。
興味のある方はご覧ください。
【FastAPI】チェックボックスの値の取得方法
https://neko-py.com/fastapi-checkbox-value-get