0
我有一个除了主页路径和我的博客页面路径以外的每个页面都有一个标题,但是我似乎无法获得'或'语句工作。任何想法都表示赞赏。谢谢。在Django的request.path {if}语句中包含多个路径
这工作
{% if request.path != '/' %}
...
{% endif %}
这不,但我需要什么
{% if request.path != '/' or request.path != '/news' %}
...
{% endif %}
它总是简单的事情,我忽略 - 谢谢。为了获得新闻路径和帖子路径本身,即/ news/post-url-path,我将它写为'{%if request.path!='/'和'/ news'not in request.path%}。 。{%endif%}' –