{% spaceless %} {% load i18n %} {% load humanize %} {% firstof limit 3 as limit %} {% with subtraction_value='-'|add:limit %} {% with remainder_count=items|length|add:subtraction_value %} {% with remainder_count_display=remainder_count|intcomma %}
{% for item in items|slice:limit %} {{ item }}{% if not forloop.last %}, {% elif remainder_count > 0 %}, {% blocktrans trimmed count counter=remainder_count %} and {{ remainder_count_display }} other {% plural %} and {{ remainder_count_display }} others {% endblocktrans %} {% endif %} {% endfor %} {% for item in items|slice:"3:" %} {{ item }}{% if not forloop.last %}, {% endif %} {% endfor %}
{% endwith %} {% endwith %} {% endwith %} {% endspaceless %}