If it is feasible for you, you could use *Intl.NumberFormat* (
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat)
 
javascript Internationalization API.



Il giorno lunedì 30 ottobre 2017 18:59:27 UTC+1, Gualter Portella ha 
scritto:
>
> Dear all,
>
> I have been trying to reformat the numbers retrieved from the DB into the 
> format used in my country (Brazil).
>
> I want to change decimals to ',' and thousands to '.'
>
> The thing is that the only solution that I can figure out is in Python 3 - 
> I am am new to programming and webdev, like this:
>
> In the model:
>    swap_separators = { ord('.'):',', ord(','):'.' }
>
> In the view:
>
>    {{ ativos = format(float(table.column), '0.2f') }}
>
>   {{=format(float(ativos), ',').translate(swap_separators)}}
>
>
> I am currently working with Python 3. My question is: will this  solution 
> work when I deploy the app in a host that uses Python 2 for web2py?
>
> If someone else has asked or posted a solution for this before, please 
> direct me to it. Otherwise, any help is really appreciated.
>
> Cheers,
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to