Saturday, May 29, 2010

Re: how to show blank spaces at the start of string in django templates

On May 29, 2:47 pm, Ogi Vranesic <o...@redcor.ch> wrote:
> Hi
>
> I formated with python numbers like e.g.:
>
> "   3457.50"
> " 11450.25"
>
> but my problem is to show them correctly one below the other
> in a column by django templates
> because the blank spaces are ignored.
> I tried with the filter escape, however it does not work.
>
> A solution would be to loop over the characters in string like:
>
> <td>{% for c in number_string %}{% if c == ' ' %}&nbsp;{% else %}{{ c }}{% endif %}{% endfor %}</td>
>
> and so to replace blank space with &nbsp; but this is very cumbersome.
--

> Can somebody tell me if we here have a simple and elegant solution?
> Thanks in advance and best regards
> Ogi

This has nothing to do with Django templates, but is an HTML question.

Try wrapping the whole list in <pre>...</pre> tags.

--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment