python - Google App Engine Datastore multiline entries not displayed as multiline in HTML -
using google app store guestbook demo example, when entering entry on multiple lines , storing it, when read , displayed appears on 1 single line.
how can make appear excactly entered, on multiple lines?
the databasemodel this:
class greeting(db.model): author = db.userproperty() content = db.stringproperty(multiline=true) date = db.datetimeproperty(auto_now_add=true) and submission form this:
self.response.out.write(""" <form action="/sign" method="post"> <div><textarea name="content" rows="3" cols="60"></textarea></div> <div><input type="submit" value="sign guestbook"></div> </form> </body> </html>""")
html ignores eol special characters \r\n or \n.
here options:
replace special characters proper html
<br>tagwrap multiline text inside
<pre>tagin case using webapp templating, try
{{greeting.content|linebreaks}}suggested @woobleset
white-space:prein css suggested @nick (example here)
Comments
Post a Comment