I have the following simple form:
class ContactEmailForm(forms.ModelForm):
subject = forms.ChoiceField(choices=SUBJECT_TYPES)
class Meta:
model = ContactEmail
fields = ('name', 'email', 'subject', 'message',)
I want to conditionally change the subject field between a choice field and text input field.
How can I do this?
This could be accomplished by overriding the
__init__
function within your ContactEmailForm class.