Total with pluralize in template Django

3

Personal I have the following code:

<div>
    <h4>{{ combination|length }} combinação{{ combination|length|pluralize }}</h4>
    <h5><b>Total:</b> {{ combination.paginator.count }} combinação{{ combination.paginator.count|pluralize }}</h5>
</div>

It returns me the amount of combinations. That is, in the plural he is making combinations. How do I fix this?

    
asked by anonymous 06.07.2016 / 16:34

1 answer

4

According to the documentation pluralize accepts the argument in the singular and plural.

<h4>
{{ combination|length }} 
combina{{ combination|length|pluralize:"ção,ções" }}
</h4>

It will show:

0 combinações
1 combinação
2 combinações
    
06.07.2016 / 20:54