I have 2 radio buttons in the UI, one for setting a variable (ng-model) say selected
as true
(ng-value=true) and other one for setting it as false
(ng-value=false). Now, when none of them is selected it results in the variable selected
being absent from the outgoing request (as expected).
However, when that is dealt with Django Forms, the self.data
dictionary in the clean()
method gives False
on accessing self.data.get('selected')
/ self.data['selected']
why is that so? Shouldn't it be None
or at least give a key-error
when it was not even present in the actual request?
Note that the variable 'selected' is actually a field in a Django Model with default=False
, is that thing responsible for this behaviour? How can I circumvent this situation considering that altering the Django Model field isn't an option?
selected
is also a simple boolean field with default=False