to be concise:
try using a <pre> tag in your HTML ;)

<pre>
{% for line in lines %}
{{ line }}
{% endfor %}
</pre>

On 02/12/2015 09:32 PM, Tom Evans wrote:
On Thu, Feb 12, 2015 at 8:25 PM, Ulisses Cruz <ulissescru...@gmail.com> wrote:
Hello
This may seem trivial but can you help?

I'm reading a file line by line and transforming it in a list of lines
(example: list_of_lines = [file_line1, file_line2, ...])
then I pass the list to a template to be displayed. (example: return
render(request, 'template/location.html', {'lines':list_fo_lines}))

In the template I have a for loop to white each line:

{% for line in lines %}
     {{ line }}<br>
{% endfor %}

Now, the problem is that, in the file I wrote from, some words in a line
have more than one space and sometimes tabs between them.
I would like to keep them in the html page as well, but in the html page the
additional spaces and tabs do not appearing.
This does not have anything to do with django, but in an HTML
document, all whitespace is collapsed.

You can use a HTML tags to denote pre-formatted content.

I know the answer may be in HTML but I'm not getting there.
So you knew this wasn't the right place to send it, but thought "What the hell?"

There are many HTML tutorials out there that describe the common HTML
tags, I'd suggest investing some of *your* time in reading them, as
writing web applications is much easier when you have a grasp of HTML.

Cheers

Tom


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54DE044F.3000202%40arkade.info.
For more options, visit https://groups.google.com/d/optout.

Reply via email to