Give line break in django form.init data

I have a form of django as follows.

class SampleForm(forms.Form):
    message = forms.CharField(widget=forms.Textarea())

When I create a form object, I want to initialize the text area of ​​the message with a long paragraph. But I need to split the text at certain positions. So I tried putting '\ n' and then '<br / ">'. Both don't seem to work !. How can this be achieved in the form of a django ?. Welcome to any suggestion.

Edit: this is the form initialization code:

 def sample_view(request):
     initial = {'message':'''Hello,\nThis is how my message \n look like. '''}
     form = SampleForm(initial=initial)
+3
source share
1 answer

'\ n' will do the trick here ...

+3
source

All Articles