price_a = models.DecimalField(max_digits=5, decimal_places=3)
Example price: 95,90
In my template:
{{ price_a }}
it display only 95,9. How can I get it to display full price (with an extra trailing 0: 95,90)?
Select the cells you want to format. On the Home tab, select Increase Decimal or Decrease Decimal to show more or fewer digits after the decimal point. Each selection or click adds or removes a decimal place. Your new decimal places setting is now in effect.
Press TAB, open the drop-down menu, and choose Number. Click in the Field Size property, open the drop-down menu, and choose Single. Press TAB, open the drop-down menu, and choose Fixed. Click in the Decimal Places property.
Use the floatformat
template filter, for example
{{ price_a|floatformat:2 }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With