how to use 'linenumbers ' in django
this is my django code:
{{ 'one<br/>two<br/>three'|linenumbers}}
and it show :
1. one
two
three
i want to know , how to开发者_运维技巧 show this using 'linenumbers' :
1. one
2. two
3. three
thanks
Never used before, but Django Docs says you should be using a return character.
in your views:
text = """
ONE
TWO
THREE
"""
then in your template:
{{ text|linenumbers }}
shows 1. ONE 2. TWO 3.THREE
EDIT:
How ever every time I have had to do this, I usually do something like:
{% for n in lines %}
<div>{{ forloop.counter }}. {{ line }}</div>
{% endfor %}
精彩评论