Reputation: 2058
I want to generate a form from a model. However one of the fields in the model is a CharField, whose value is mostly "Option1" "Option2" or "Option3". If the user chooses "Other" I would like him to be able to type the value of the field.
How can I do this without having to write a whole form by hand?
Upvotes: 0
Views: 53
Reputation: 13096
I think one only way could be to build your own widget and associate that widget with that CharField on a ModelForm
UPDATE
Here's a sample custom widget implementation that inherits from TextInput:
Upvotes: 1