我正在研究 Django 模板并设置条件分支是否存在“查询”。
{% if {{ request.GET.query }} == "" %}
<td><a href="/detail/{{item.id}}/{{item.item_hs6}}">detail</a></td>
{% else %}
<td><a href="/detail/{{item.id}}/{{item.item_hs6}}/{{ request.GET.query }}">detail</a></td>
{% endif %}
当我执行上面的代码时,错误发生在这里。
异常类型:TemplateSyntaxError 异常值:无法解析余数:'{{' from '{{'
我知道下面的代码有问题
{% if {{ request.GET.query }} == "" %}
如何判断Template中是否有查询?
我刚刚在这个问题中提到了上述设置,但如果需要更多代码,然后告诉我我会用这些信息更新我的问题。谢谢