1

trying to output the correct plural value in Django template when count is more than 1.

<p>{{ review.markers.helpful.count }} person{{ reviews.markers.helpful.count|length|pluralize }} found this helpful</p>

still returns 1 persons or 2 persons instead of 1 person and 2 people

any help to fix this in the template?

coder-stix
  • 53
  • 5

1 Answers1

1

You can specify the suffixes of the two forms with:

pe{{ reviews.markers.helpful.count|pluralize:"rson,eople" }}

or simpler:

{{ reviews.markers.helpful.count|pluralize:"person,people" }}
Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555