{% with start=0 end=entries.number|add:"2" %}
{{ paginator.page_range|slice:"start:end" }}
{{ start }}, {{ end }}
{{ paginator.page_range|slice:"0:3" }}
{% endwith %}
为什么 Django 1.5 模板引擎会为上述代码生成以下输出:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
0, 3
[1, 2, 3]