gpt4 book ai didi

html - Django : Could not parse the remainder: '{{' from '{{

转载 作者:行者123 更新时间:2023-12-03 08:06:21 25 4
gpt4 key购买 nike

当我执行HTML代码时,会出现以下错误:

Could not parse the remainder: '{{' from '{{'

我也尝试嵌套条件,但是我绝对是HTML的初学者,所以我希望至少获得正确的版本,但是它不起作用...
{% block content %}
<p align="justify"> So far you donated {{ donated_trees }} Tree(s). </p>
{% if treatmentgroup == 'two' or treatmentgroup == 'three' %}
Your current position is {{ player.end_position }} of {{ anzahlspieler }} for the most donated trees.
{% endif %}

{% if treatmentgroup == 'two' or treatmentgroup == 'three' and {{ player.rival }} == 0 %}
<P> No other player has the same.</P>
{% endif %}

{% if treatmentgroup == 'two' or treatmentgroup == 'three' and {{ player.rival }} == 1 %}
<P> One other player has the same.</P>
{% endif %}

{% if treatmentgroup == 'two' or treatmentgroup == 'three' and {{ player.rival }} > 1 %}
<P> {{ player.rival }} other players have the same.</P>
{% endif %}

从第8行开始发生错误。

最佳答案

您不能在模板标记内使用{{ … }},而只能使用变量本身:

{% block content %}
<p align="justify"> So far you donated {{ donated_trees }} Tree(s). </p>
{% if treatmentgroup == 'two' or treatmentgroup == 'three' %}
Your current position is {{ player.end_position }} of {{ anzahlspieler }} for the most donated trees.
{% endif %}

{% if treatmentgroup == 'two' or treatmentgroup == 'three' and player.rival == 0 %}
<P> No other player has the same.</P>
{% endif %}

{% if treatmentgroup == 'two' or treatmentgroup == 'three' and player.rival == 1 %}
<P> One other player has the same.</P>
{% endif %}

{% if treatmentgroup == 'two' or treatmentgroup == 'three' and player.rival > 1 %}
<P> {{ player.rival }} other players have the same.</P>
{% endif %}

关于html - Django : Could not parse the remainder: '{{' from '{{,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58189242/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com