有没有一个django模板过滤器来显示百分比? [英] Is there a django template filter to display percentages?
本文介绍了有没有一个django模板过滤器来显示百分比?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要类似于标准库中的字符串格式>。
I would like something similar to the string formatting from the standard library.
'%'百分比。将数字
乘以100,并以固定('f')
格式显示,然后按百分号显示。
'%' Percentage. Multiplies the number by 100 and displays in fixed ('f') format, followed by a percent sign.
推荐答案
string.Formatter()
的新颖意味着Django不太可能支持内置。写或找到实现它的模板标签或过滤器。
The newness of string.Formatter()
means that Django is not likely to support it built-in. Either write or find a template tag or filter that implements it.
这篇关于有没有一个django模板过滤器来显示百分比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文