开发者

Calling an attribute or function of a variable obtained through a template filter

This is what I want to write:

categories|last.translated_name

Where categories is a list of Category objects and translated_name is a function in the Category class.

This is the error when the above invalid syntax is used:

Could not parse the remainder: '.tra开发者_运维问答nslated_name' from 'categories|last.translated_name'


{% with categories|last as last_category %}
    {{ last_category.translated_name }}
{% endwith %}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜