Reputation: 2575
I have a django form as given below.
class SampleForm(forms.Form):
message = forms.CharField(widget=forms.Textarea())
When I create a form object i want to initialize the 'message' textarea with a long paragraph. But I need to split the text at certain positions. So I tried to put '\n' and then '< br />'. Both seems not working!. How can this be achieved in django form?. welcome for 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)
Upvotes: 3
Views: 1399