add_float

Overview

Adds a floating point number to the value. Note that both the argument and value are cast to floating point numbers before performing the addition. This is the primary difference between this filter and the built-in add in Django. add will concatenate two strings representing floating points, rather than add them together. For example, consider the following code:

{{ price|add:salestax }}

If price and salestax are the strings “1.00” and “0.07” respectively, with the built-in add, the result is “1.000.07”. The result of add_float is 1.07

Example

{{ price|add_float:salestax }}