フォームにフィールドがあります
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
動的に初期化するときに使用する必要があるため、ウィジェットを使用できません。これを行うにはどうすればよいですか。form.fields['myForm'].widgets.choices =