问题
Friends,I want to add default value to django MarkItUpWidget
title = forms.CharField(max_length = 30)
content = forms.CharField(widget=MarkItUpWidget())
回答1:
The way to provide an initial value for unbound forms in Django is the initial
argument.
content = forms.CharField(widget=MarkItUpWidget(), initial='initial value')
回答2:
set the value in the form definition:
q = forms.CharField(label='search' widget=forms.TextInput(), initial=123)
来源:https://stackoverflow.com/questions/9849975/how-to-add-default-value-to-django-markitup-widget