问题描述
This is my model.py where my gender is a booleanfield
This is my forms.py where i put my gender as a choicefield and the widget is radioselect
Maybe my wrong is in the views.py but i don't know how to fix
This is the error that i need to fix Please help me
解决方法
data = {'first_name': form.cleaned_data.get('first_name'),....}
data['gender'] = True if form.cleaned_data.get('gender') == 'M' else False
mo = Monitor.objects.create(**data)