Django template roundup scientific notation

django, django-templates

Solution

You can use:

{{ data|stringformat:".2e" }}

The`.<number>` syntax specifies number of decimal points. See reference for more info.

Problem

I'm trying to convert, eg: ``` 0.00282357936911 to 2.82e-03 and 0.000130076846614 to 1.30e-04 ``` However, when I use the filter `{{ data|stringformat:"e" }}`, I get ``` 2.823579e-03 and 1.300768e-04 ``` Is there are way to roundup to 2 decimal points? Many thanks in advance.

Original source