'Remove the decimal part of a floating-point number in django?
I have a variable called {{value.item_total }} which is 499.00, but I want to remove the decimal points for this value in my templates file to make it 499. How could I do this?
Solution 1:[1]
you have to use Built-in template tags and filters (https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#get-digit). In your case use
{{ value.item_total|floatformat:"0" }}
Thats it.
Greetings
Solution 2:[2]
{{value.item_total|floatformat }}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | bofh |
| Solution 2 | catherine |
