0
我在我的形式Django的動態ChoiceField和驗證錯誤
myFormList = [(u'Select',u'Select')]
myForm = forms.ChoiceField(choices=myFormList)
場,我初始化它使用動態
form.fields['myForm'].choices = form.fields['myForm'].choices + anotherMyFormList
這Select a valid choice. ** is not one of the available choices
通常導致驗證錯誤我擺脫這個錯誤
myForm = forms.CharField(widget = forms.Select(choices=myFormList))
但因爲我必須使用form.fields['myForm'].choices
同時動態初始化我不能用widgets.How做這form.fields['myForm'].widgets.choices =