标签: django django-templates decimal
price_a = models.DecimalField(max_digits=5, decimal_places=3)
示例价格:95,90
在我的模板中:
{{ price_a }}
它只显示95,9。如何让它显示全价(额外的尾随0:95,90)?
答案 0 :(得分:35)
使用floatformat模板过滤器,例如
floatformat
{{ price_a|floatformat:2 }}