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:

  1. replace special characters proper html <br> tag

  2. wrap multiline text inside <pre> tag

  3. in case using webapp templating, try {{greeting.content|linebreaks}} suggested @wooble

  4. set white-space:pre in css suggested @nick (example here)


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -