在使用Django模板复数过滤器的句子中定义is / are的最佳方法是什么? 例如:
<p>
Your item{{ items|length|pluralize }}
is/are
currently being processed and will ship soon.
</p>
答案 0 :(得分:8)
如pluralize
的最后一个示例所示,您可以尝试
Your item{{ items|length|pluralize:" is,s are" }}
currently being processed and will ship soon.
答案 1 :(得分:4)
将pluralize
与备用后缀参数一起使用。
<p>
Your item{{ items|length|pluralize }}
{{ items|length|pluralize:"is,are" }}
currently being processed and will ship soon.
</p>