django thousand separator for product price in templates
i have the product price in decimals,
like 15000.0000
now i want to ap开发者_如何学运维ply thousand separator on it, intcomma
filter works fine with decimals as here
but after it i can't apply currency
filter, means it didn't work with currency filter.
i want final output of my Price: PKR 15,000.00
any suggestions to get this?
Thanks :)
The satchmo currency
filter requires something that can be converted into a Decimal. However intcomma
returns a string, and since it adds the thousand separators, it can no longer be converted to a Decimal.
The solution would be to write a currency_with_intcomma
template filter yourself, which first runs through the currency
filter and then applies the thousand separators (you can't use the builtin filter for that, you'll have to do it "manullay").
精彩评论