如何在Jinja标签中使用jinja标签

Gna*_*ian 1 python django jinja2

这是我的代码:

{% if {{post.author.profile.image.url}} is None %}
Run Code Online (Sandbox Code Playgroud)

当我运行此代码时,出现错误

Could not parse the remainder: '{{post.author.profile.image.url}}' from '{{post.author.profile.image.url}}'
Run Code Online (Sandbox Code Playgroud)

如何解决呢?以及如何在模板标签中使用模板标签

abd*_*sco 5

直接使用expression的值,不应将其包装在大括号内:

{% if post.author.profile.image.url is None %}
   ...
{% endif %}
Run Code Online (Sandbox Code Playgroud)