Is there a django template filter to get only digits after the floating point?
For example :
2.34 --> 34
2.00 --> 00
1.10 --> 10
>
Aside from creating your own custom filter, you can solve it using django-mathfilters package:
{{ value|mod:1|mul:100|floatformat:"0" }}
where:
mod
is a "modulo" filter provided by mathfilters
mul
is a "multiplication" filter provided by mathfilters
Demo:
>>> from django.template import Template, Context
>>> c = Context({'value': 2.34})
>>> t = Template('{% load mathfilters %}{{ value|mod:1|mul:100|floatformat:"0" }}')
>>> t.render(c)
u'34'