是否有人知道如何在Django模板中执行数学函数?我想从另一个减去一个数字。在Django模板中减去2个整数
{% for person in persons %}
<tr>
<td>{{ person.birthday|date:"jS M" }}</td>
<td>{{ person.name }}</td>
<td>Minus this {% now "Y" %} from this {{ person.birthday|date:"Y" }}</td>
<td>{{ person.address }}</td>
</tr>
{% endfor %}
</table>
谢谢!
http://stackoverflow.com/questions/9948095/variable-subtraction-in-django-templates – ndpu 2013-04-28 20:07:53