Задать вопрос

Тел: +7 965 3737 888

356

Просмотров

1

Ответов

Template Tag for Random Selection of Any Line

<p>These are template tags meant to support the construction of text in a random or seeded random (reproducible) way.  Two tags are provided: seed_randomization and any.
</p>
<p>Only seed the randomization if you wish to have the options generated the same way each time.  Only necessary once per request, if done early enough in the rendering process.
</p>
<p>Example without seeding:
</p>
&lt;p&gt;
{% any %}
One day
Once upon a time
In a galaxy far, far away
{% endany %}
a young foolish {% any %}programmer|lawyer|Jedi{% endany %}
{% any %}
set out
began his quest
ran screaming 
{% endany %}
to pay his stupid tax.
&lt;/p&gt;

# Possible outcomes:
&lt;p&gt;In a galaxy far, far away a young foolish lawyer set out to pay his stupid tax.&lt;/p&gt;
&lt;p&gt;One day a young foolish programmer ran screaming to pay his stupid tax.&lt;/p&gt;
<p>Be sure to read the documentation in the code.
</p>

Вопрос полезен? Да0/Нет0
file_4801.py(3.2Кб)
None

Ответы (1):

Ответklaidi:23.07.2010
Ответ полезен? Да0/Нет0

like