在 HTML 中,我尝试执行双重处理,第二个从父亲那里继承数据,如下所示:
{% for category in categories %}
<li><a href="/categories/{{ category.id }}/">{{ category.name }}</a>
{% for cat in category.objects.filter(parent=category.id) %}
{% if forloop.first %}
<ul class="noJS">
{% endif %}
<li><a href="/categories/{{ cat.id }}">{{cat.name}}</a></li>
</ul>
{% endfor %}
{% endfor %}
问题是我收到错误:
TemplateSyntaxError at /
Could not parse the remainder: '(parent=category.id))' from 'ca
tegory.objects.filter(parent=category.id))'
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.4.3
Exception Type: TemplateSyntaxError
Exception Value:
Could not parse the remainder: '(parent=category.id))' from 'category.objects.filter(parent=category.id))'
任何的想法?