How to add default value to django-markitup widget?

浪尽此生 提交于 2019-12-12 02:47:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!