django multivaluefield & multiwidget - make one optional
问题 This is related to an earlier question of mine. I want to have a MultiValueField which contains a Choice and TextInput widget. If the user selects "OTHER" from the Choice, then the value of the TextInput should be saved. Otherwise, the value of the Choice should be saved. So far I have the following code: custom_choices = [("one","one"),("two","two"),("OTHER","OTHER")] class MyMultiWidget(forms.MultiWidget): def __init__(self,*args,**kwargs): widgets = ( forms.Select(choices=custom_choices),