Example, for this form:
>>> class CommentForm(forms.Form):
... name = forms.CharField(initial='class')
... action = forms.ChoiceField(...)
Can I have the choices in the action field be different depending on what is in the name field?
Example, for this form:
>>> class CommentForm(forms.Form):
... name = forms.CharField(initial='class')
... action = forms.ChoiceField(...)
Can I have the choices in the action field be different depending on what is in the name field?
How about wrapping initial in a function or a lambda, so that the value of initial is deferred until form creation. Something like:
class CommentForm(forms.Form):
name = forms.CharField(initial=lambda : self.action) # or more complex logic
action = forms.ChoiceField(...)