Django's pluralize template filter


Django tip:

Sometimes you need to use the single or plural form based on the number you're displaying. You can handle this by using the pluralize filter.

{{ number_of_friends }} friend{{ number_of_friends|pluralize }}

# 1 friend
# 2 friends 

An "s" is automatically used as the suffix, but you can also provide your own suffix (for both singular and plural versions).

{{ number_of_mice }} {{ number_of_mice|pluralize:"mouse,mice" }}

# 1 mouse
# 2 mice