Is there any way to have a random string in a Django template?
I would like to have multiple strings displaying randomly like:
{% here generate random number rnd ?%}
{% if rnd == 1 %}
{% trans "hello my name is john" %}
{% endif %}
{% if rnd == 2 %}
{% trans "hello my name is bill" %}
{% endif %}
EDIT:
Thanks for answer but my case needed something more specific as it was in the base template (which I forgot to mention sorry ). So after crawling Google and some docs I fall on context processor article which did the job, I found it a little bit "heavy" anyway just for generating a random number...
here is the blog page : http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/
Template tag did not the trick (or I did not find how) as it return a tag that cannot be translated as I remember (see blocktrans doc)
I did not find a way to generate a number for the base view (is there any?) and if there is a way better than context process I'd be glad to have some info.