I tried printing out all (key,value) pairs in a request.POST
to extract the form data. I notice that a BooleanField, if not checked (i.e. set to True
), is not included in request.POST
. This is true even if the BooleanField is set with required=True
.
Is it possible to force the (key,pair) to be sent? For example, in this form below, if applied
field is not checked when rendered, request.POST
should still include applied off
? When applied
is checked, request.POST
includes applied on
. But without being checked, applied
is not part of request.POST
data.
class ItemModifierForm(forms.Form):
applied= forms.BooleanField(label='Trait A', required=True)