0
我的觀點給我的列表或報告,而當前用戶呼叫方法
在我的模板我想做的事:
{% 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似乎無法使用模板中的參數調用方法。
所以,我必須這樣做在查看...
你有一個想法怎麼做是否正確?
由於
也:http://stackoverflow.com/questions/1333189/django-template-system-calling -a-功能裏面,一個模型 – danihp