我有两次: {{maine.job_time}} 和 {{maine.transport_time}} ,我可以使用{%load mathfilters%}添加它们。这很好用。 我现在想检查一下{{aine.job_time |的结果add:maine.transport_time}}等于“3:00:00”显示OK。但我的病情不起作用。 你能帮我解决这个问题吗? 谢谢 这是我的Django模板:
{% extends 'blog/base.html' %}
{% load mathfilters %}
{% block content %}
{% if semain %}
<div class="container">
<table class="table table-bordered" >
<thead>
<tr>
<th> {{ dim }} </th>
</tr>
</thead>
<tr>
<td>
{% for maine in SemaineView %}
{% if maine.date|date:"D" == "dim" %}
<p class='postcontent' ><strong>job:</strong> {{ maine.job_time}}</p>
<p class='postcontent' ><strong>transport:</strong> {{ maine.transport_time }}</p>
<p class='postcontent' ><strong>Total:</strong> {{ maine.job_time|add:maine.transport_time }}</p>
{% if maine.job_time|add:maine.transport_time== "3:00:00" %}
<h1> ok </h1>
{% else %}
<h1> Non </h1>
{% endif %}
{% endif %}
{% endfor %}
{{ tr }}
</td>
</tr>
</table>
</div>
{% endif %}
{% endblock %}