模板中的数学筛选
django-template-maths的Python项目详细描述
===
django template math
==
django template math是模板中执行数学的简单筛选器
quick start
----
1。将“django_template_math”添加到已安装的应用程序设置中,如下所示::
installed_apps=[
…
“django_template_math”,
]
Example usage
-------------
```html
{% load django_template_maths %}
{{ 10|add:5 }} # print 15
{{ 10|sub:5 }} # print 5
{{ 10|div:5 }} # print 2
{{ 10|mul:5 }} # print 50
{{ 10|mod:5 }} # print 0
{{ 10|exp:5 }} # print 100000
{{ 10|flr:5 }} # print 2
{{ 10|sqr }} # 3.1622776601683795
{{ 10|add:5|add_decimal:2 }} # print 15.00
{{ 1000|add:5|add_decimal:2|separator:'comma' }} # print 1,005.00
{{ 1000|add:5|add_decimal:2|separator:'dot' }} # print 1.005,00
{{ 1000|remove_decimal|separator:'dot' }} # print 1.005
{{ 50|percent_of_number:500 }}打印10,0
```
django template math
==
django template math是模板中执行数学的简单筛选器
quick start
----
1。将“django_template_math”添加到已安装的应用程序设置中,如下所示::
installed_apps=[
…
“django_template_math”,
]
Example usage
-------------
```html
{% load django_template_maths %}
{{ 10|add:5 }} # print 15
{{ 10|sub:5 }} # print 5
{{ 10|div:5 }} # print 2
{{ 10|mul:5 }} # print 50
{{ 10|mod:5 }} # print 0
{{ 10|exp:5 }} # print 100000
{{ 10|flr:5 }} # print 2
{{ 10|sqr }} # 3.1622776601683795
{{ 10|add:5|add_decimal:2 }} # print 15.00
{{ 1000|add:5|add_decimal:2|separator:'comma' }} # print 1,005.00
{{ 1000|add:5|add_decimal:2|separator:'dot' }} # print 1.005,00
{{ 1000|remove_decimal|separator:'dot' }} # print 1.005
{{ 50|percent_of_number:500 }}打印10,0
```