开发者

django handle newlines in textarea

  <textarea id="my" ></textarea>

  p=post(body=value)
  p.save()

Here I am trying to save the content of the textarea to database开发者_开发问答 but i see that new lines are converted to spaces and then saved.How to handle this on the server side..


They're almost certainly not being converted to new-lines, the problem is likely to be the way you're displaying them.

Try displaying them in your template using the linebreaks filter, like this:

{{ mypost.body|linebreaks }}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜