📜  django-mathfilters - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:07.790000             🧑  作者: Mango

代码示例1
{% load mathfilters %}

...

Basic math filters

  • 8 + 3 = {{ 8|add:3 }}
  • 13 - 17 = {{ 13|sub:17 }}
  • {% with answer=42 %}
  • 42 * 0.5 = {{ answer|mul:0.5 }}
  • {% endwith %} {% with numerator=12 denominator=3 %}
  • 12 / 3 = {{ numerator|div:denominator }}
  • {% endwith %}
  • |-13| = {{ -13|abs }}