所以我只想显示最后六个词并截断第一部分。
{% for each_season in season %}
<a href="{% url 'season_detail' slug=each_season.slug %}">{{each_season|something}}</a>
{% endfor %}
我可以投入什么来实现这个目标?
答案 0 :(得分:1)
使用slice过滤器
例如:
{% for each_season in season %}
<a href="{% url 'season_detail' slug=each_season.slug %}">{{each_season|slice:"-6:"}}</a>
{% endfor %}