0

朋友们,我想给 django MarkItUpWidget 添加默认值

title = forms.CharField(max_length = 30)

    content = forms.CharField(widget=MarkItUpWidget())
4

2 回答 2

2

在 Django 中为未绑定表单提供初始值的方法是initial参数。

content = forms.CharField(widget=MarkItUpWidget(), initial='initial value') 
于 2012-03-24T08:38:14.930 回答
0
set the value in the form definition:
 q = forms.CharField(label='search' widget=forms.TextInput(), initial=123)
于 2012-03-24T11:24:23.687 回答