如何为django-markitup小部件添加默认值?

时间:2012-03-24 07:35:24

标签: django django-models django-forms django-widget

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

title = forms.CharField(max_length = 30)

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

2 个答案:

答案 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)