In python I can write "Hello" * 5 and get
HelloHelloHelloHelloHello
Is there a way to do this in a django template? Something like {% multiply "Hello" 5 %} or as a filter {% "Hello"|multiply:"5" %}
Or maybe a “repeat” loop control? Something like:
{% repeat 5 %}
Hello
{% endrepeat %}
I can write a filter or tag myself, but was wondering if I could save myself some trouble.
If someone can authoritatively say that there is no built-in capability such as I require, that would be a perfectly acceptable answer.
There is no built-in capability such as you require.
That would be a trivial tag to make for yourself – there are some helpful examples in the Django docs.
I suppose you could hack something together by using something like
{% for x in "12345" %}Hello{% endfor %}but that is a horrible hack.