librelist archives

« back to archive

missing newlines in the templates

missing newlines in the templates

From:
Abdul Bijur Vallarkodath
Date:
2011-05-26 @ 13:38
Hey all,

I am updating data into the database and showing it from the db using a 
template

<tr>
<td> {{ update['update'] }}</td>
</tr>

The problem is that this swallows all newlines "\n"  and breaks in the 
text field. When I check the database, I see the line breaks within the 
database.

Any help is appreciated.

Abdul

Re: [flask] missing newlines in the templates

From:
Ron DuPlain
Date:
2011-05-26 @ 13:44
Hi Abdul,

On Thu, May 26, 2011 at 9:38 AM, Abdul Bijur Vallarkodath
<bijur@grep-i.com> wrote:
> The problem is that this swallows all newlines "\n"  and breaks in the
> text field. When I check the database, I see the line breaks within the
> database.

HTML itself doesn't display much whitespace.  Try it -- create a
simple HTML file in a text editor and load that file directly in your
web browser.  You'll have to use some sort of template filter, <pre>
block, or markup.

-Ron

Re: [flask] missing newlines in the templates

From:
Abdul Bijur Vallarkodath
Date:
2011-05-27 @ 09:12
On 26/05/11 15:44, Ron DuPlain wrote:
> Hi Abdul,
>
> On Thu, May 26, 2011 at 9:38 AM, Abdul Bijur Vallarkodath
> <bijur@grep-i.com>  wrote:
>> The problem is that this swallows all newlines "\n"  and breaks in the
>> text field. When I check the database, I see the line breaks within the
>> database.
> HTML itself doesn't display much whitespace.  Try it -- create a
> simple HTML file in a text editor and load that file directly in your
> web browser.  You'll have to use some sort of template filter,<pre>
> block, or markup.
>
> -Ron
Hey,

Thanks! This worked. I used pre with a style

<pre style="white-space:line-wrap">

This solved my problems.

Thanks,
Abdul