0

template.html

django では、このような状態を確認することは可能ですが、この行 (incident.other_location または location) でエラーが発生しています。

{%if newreport_tab and reportperson and incident.manual_date and media  and followup and (incident.other_location or location) and incident.other_incident_type and types%}<a href="{% url incident.views.savereport %}">{% include "buttons/saveandclose.html" %}</a>{%else%}{% include "buttons/saveandclose.html" %}{%endif%}

このエラーが発生しています

"TemplateSyntaxError at /report/savereport/
Could not parse the remainder: '(incident.other_location' from 'and(incident.other_location'"
4

1 に答える 1

2

(括弧) を使用して操作を結合することはできません()が、代わりに、次の演算子の優先順位に従うことができます。

  • また
  • いいえ
  • ==、!=、<、>、"<="、>=

評価前or

{%if newreport_tab and reportperson and incident.manual_date and media  and followup and incident.other_location or location and incident.other_incident_type and types%}<a href="{% url incident.views.savereport %}">{% include "buttons/saveandclose.html" %}</a>{%else%}{% include "buttons/saveandclose.html" %}{%endif%}

評価後or

{%if newreport_tab and reportperson and incident.manual_date and media  and followup and someresult and incident.other_incident_type and types%}<a href="{% url incident.views.savereport %}">{% include "buttons/saveandclose.html" %}</a>{%else%}{% include "buttons/saveandclose.html" %}{%endif%}
于 2013-07-26T04:54:58.087 に答える