Django Forms 货币格式化问题 form中有货币相关的字段, 字段类型是Decimal,希望在template中显示为货币格式,比如:123,456.00。 尝试了django.contrib.humanize的方法:{{ '1234567.924'|floatformat:2|intcomma }},但发现humanize只能作用在单个tag上,而无法作用到template的form上。 清问,如何能将template中的form中的多个字段显示为货币格式? 评论 2 登录评论 2592350443@qq.com 2022-01-04 没用过这个 Field ,提供个思路,template 没有语法糖的话直接 split ,用 context 传到页面。 更优思路,GitHub 找相关三方库。 本人5年后端,需要兼职联系我,v信:watch05168 2022-01-06 单笔金额这么大么,我们一般就几十块,没有遇到过,建议前端渲染的时候,改下数字格式
2592350443@qq.com 2022-01-04 没用过这个 Field ,提供个思路,template 没有语法糖的话直接 split ,用 context 传到页面。 更优思路,GitHub 找相关三方库。
评论 2
没用过这个 Field ,提供个思路,template 没有语法糖的话直接 split ,用 context 传到页面。 更优思路,GitHub 找相关三方库。
单笔金额这么大么,我们一般就几十块,没有遇到过,建议前端渲染的时候,改下数字格式