[Tutor] Bar Operator ??
Mitya Sirenef
msirenef at lightbird.net
Sun Mar 10 02:48:59 CET 2013
On 03/09/2013 08:39 PM, Mark Lybrand wrote:
> I am working through the Django tutorial and I have come across some syntax I am unfamiliar with. From
the context it makes perfect sense what it does, but I haven't seen it
before and was wondering if it is documented anywhere (BTW I see other
examples in the Django documentation, like date formatting for example).
>
> So what is this "|pluralize" syntax? Thanks in andvance
>
> <h1>{{ poll.question }}</h1>
>
> <ul>
> {% for choice in poll.choice_set.all %}
> <li>{{ choice.choice_text }} -- {{ choice.votes }} vote{{
choice.votes|pluralize }}</li>
> {% endfor %}
> </ul>
>
> <a href="{% url 'polls:detail' poll.id %}">Vote again?</a>
>
>
>
> --
> Mark :)
>
>
It's a filter:
https://docs.djangoproject.com/en/1.5/ref/templates/builtins/
--
Lark's Tongue Guide to Python: http://lightbird.net/larks/
Whosoever is delighted in solitude is either a wild beast or a god.
Sir Francis Bacon
More information about the Tutor
mailing list