How can i round a value in django template without using the filter

后端 未结 1 506
执笔经年
执笔经年 2020-12-20 12:07

Is there any way that I can do some python math function in django template. Actually I need to round a variable value and I want to achieve this without using the filters.<

相关标签:
1条回答
  • 2020-12-20 12:54

    You can use floatformat to round of the value in django template.

    {{ total|floatformat }}
    

    If you want to perform more mathematical operations, you can try django-mathfilters. Or you could write your custom template tag and perform the operations in that template tag.

    0 讨论(0)
提交回复
热议问题