【发布时间】:2014-04-06 06:48:24
【问题描述】:
我的视图给我一个列表或报告和当前用户
在我想要做的模板中:
{% for report in reports %}
...
{% if current_user.can_edit_report(report) == True %}
...
{% endif %}
...
{% endfor %}
但这会引发错误
Could not parse the remainder: '(report)' from 'current_user.can_edit_report(report)'
因为 Django 似乎无法在模板中调用带有参数的方法。
所以我必须在视图中这样做...
你知道如何正确地做到这一点吗?
谢谢
【问题讨论】: