Django TemplateSyntaxError Could not parse the remainder: '()'

返回的数据是列表集合,如

n [5]: a = set()                                                                  

In [6]: a.add((1, 3))

In [7]: a
Out[7]: {(1, 3)}

在模板中使用方式如下:

 {% for archive in archive_lists  %}
<li>
<a href="/archive/{{ archive.0 }}/{{ archive.1 }} ">{{ archive }}</a>
</li>
{% endfor %}

参考见:

http://stackoverflow.com/questions/5231171/django-templatesyntaxerror-could-not-parse-the-remainder

  

原文地址:https://www.cnblogs.com/wswang/p/5579179.html