I noticed there is built-in add filter, but I wasn't able to find divide.
add
divide
I am new to Django and not sure if there is a such filter.
There is not it. But if you are a little hacker....
http://slacy.com/blog/2010/07/using-djangos-widthratio-template-tag-for-multiplication-division/
to compute A*B: {% widthratio A 1 B %} to compute A/B: {% widthratio A B 1 %} to compute A^2: {% widthratio A 1 A %} to compute (A+B)^2: {% widthratio A|add:B 1 A|add:B %} to compute (A+B) * (C+D): {% widthratio A|add:B 1 C|add:D %}
to compute A*B: {% widthratio A 1 B %}
to compute A/B: {% widthratio A B 1 %}
to compute A^2: {% widthratio A 1 A %}
to compute (A+B)^2: {% widthratio A|add:B 1 A|add:B %}
to compute (A+B) * (C+D): {% widthratio A|add:B 1 C|add:D %}
Also you can create a filter to division in 2 minutes
2.1m questions
2.1m answers
60 comments
57.0k users