0

Friends,I want to add default value to django MarkItUpWidget

title = forms.CharField(max_length = 30)

    content = forms.CharField(widget=MarkItUpWidget())
  • 2
    You can't add 'default value' for widget because widgets don't have default values, they are just for rendering. Fields can have default (initial) values. – Mikhail Korobov Mar 24 '12 at 11:59

2 Answers2

3

The way to provide an initial value for unbound forms in Django is the initial argument.

content = forms.CharField(widget=MarkItUpWidget(), initial='initial value') 
Alasdair
  • 298,606
  • 55
  • 578
  • 516
0
set the value in the form definition:
 q = forms.CharField(label='search' widget=forms.TextInput(), initial=123)
Invincible
  • 412
  • 3
  • 19