Split before decimal in django -


i have variable fetches data database

{{i.rewardpoints}}

and values returns such 1.799 or 12 db has multiple values contains decimals , without decimals

but need show values without decimals

how can this

to round nearest integer:

{{ i.rewardpoints|floatformat:"0" }} 

to integer part:

{{ i.rewardpoints|stringformat:"d" }} 

in [19]: tpl = template('{{ x|stringformat:"d" }} {{ x|floatformat:"0" }}')  in [20]: tpl.render(context({'x': 1.1})) out[20]: u'1 1'  in [21]: tpl.render(context({'x': 1.9})) out[21]: u'1 2' 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -