朋友们,我想将默认值添加到django MarkItUpWidget
title = forms.CharField(max_length = 30)
content = forms.CharField(widget=MarkItUpWidget())
答案 0 :(得分:2)
在Django中为未绑定表单提供初始值的方法是initial
参数。
content = forms.CharField(widget=MarkItUpWidget(), initial='initial value')
答案 1 :(得分:0)
set the value in the form definition:
q = forms.CharField(label='search' widget=forms.TextInput(), initial=123)