1๐
โ
If a checkbox is not checked, it is simply not part of the request. So if you tick answ2
, and answ4
, then answ0
, answ1
and answ3
will not be part of the request.
You thus will look at:
if 'answ0' in request.POST:
pass # ๐ checked
else:
pass # ๐ not checked
Checkboxes are a bit tricky, just like date
input for example. Therfore typically a Django Form
ย [Django-doc] is typically used at least to validate and clean the input.
Source:stackexchange.com