My model has quite a few boolean fields. I've broken these up into 3 sets which I'm rendering as a MultipleChoiceField
w/ a modified CheckboxSelectMultiple
.
Now I need to save this data back to the DB. i.e., I need to split the data returned by a single widget into multiple boolean columns. I think this is appropriate for the save()
method, no?
Question is, how do I do I do it? Something like this?
def save(self, commit=True):
# code here
return super(MyForm, self).save(commit)
If so... how do I set the values?
self.fields['my_field'].value = 'my_flag' in self.cleaned_data['multi_choice']
Or something? Where's all the data stored?