Python if条件循环中的问题
template.html 在django中,是否可以检查这样的条件,我在这一行中得到错误(incident.other_位置或位置) 不能使用Python if条件循环中的问题,python,django,django-models,django-templates,Python,Django,Django Models,Django Templates,template.html 在django中,是否可以检查这样的条件,我在这一行中得到错误(incident.other_位置或位置) 不能使用()(括号)组合操作,但可以遵循以下运算符的优先级: 或 及 不是 在 ==,!=,,"= 在或评估之前: {%if newreport_tab and reportperson and incident.manual_date and media and followup and incident.other_location or locati
()
(括号)组合操作,但可以遵循以下运算符的优先级:
- 或
- 及
- 不是
- 在
- ==,!=,,"=
或评估之前:
{%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%}
{%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%}
{%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%}
{%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%}