概述
from django import forms class MyForm(forms.Form): check = forms.BooleanField(required = True) # your other form fields
对于BooleanField,required = True将检查是否选中该框.这是因为只有选中后才会提交数据.
资料来源:https://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.BooleanField
Validates that the value is True (e.g. the check Box is checked) if the field has required=True.
总结
以上是编程之家为你收集整理的python – Django:要求勾选复选框以提交表格全部内容,希望文章能够帮你解决python – Django:要求勾选复选框以提交表格所遇到的程序开发问题。
如果您也喜欢它,动动您的小指点个赞吧