[google-appengine] Re: currency or comma in float numbers format

2009-01-03 Thread Remis B

That is fine but I have another question, How can I make and filter to
be used in GAE templates. I mean to be able to use something like this
{{ product.price|my_money_format_filter}} where my_money_format_filter
is my own implementation of the filter.

Remis B

On Jan 3, 2:30 am, warreninaustintexas warreninaus...@gmail.com
wrote:
 I wrote my own function to convert since I couldn't find a Django
 filter or Python library to do so.  I convert to a summary style
 format instead of full-precision currency:

   if abs(what_number)  10:
     return_string = str(round(float(what_number)/10,places)) +
 B
   elif abs(what_number)  100:
     return_string = str(round(float(what_number)/100,places)) +
 M
   elif abs(what_number)  1000:
     return_string = str(round(float(what_number)/1000,places)) + K
   else:
     return_string = str(round(float(what_number),places))

 Hope that helps.
 w.

 On Jan 2, 5:31 pm, Shay Ben Dov shay.ben...@gmail.com wrote:

  Hi,
  Anyone knows how to implement in GAE
  currency formating of floating numbers like:
  {{ value|floatformat:2 }} built_in filter
  Shay
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: currency or comma in float numbers format

2009-01-02 Thread warreninaustintexas

I wrote my own function to convert since I couldn't find a Django
filter or Python library to do so.  I convert to a summary style
format instead of full-precision currency:

  if abs(what_number)  10:
return_string = str(round(float(what_number)/10,places)) +
B
  elif abs(what_number)  100:
return_string = str(round(float(what_number)/100,places)) +
M
  elif abs(what_number)  1000:
return_string = str(round(float(what_number)/1000,places)) + K
  else:
return_string = str(round(float(what_number),places))

Hope that helps.
w.

On Jan 2, 5:31 pm, Shay Ben Dov shay.ben...@gmail.com wrote:
 Hi,
 Anyone knows how to implement in GAE
 currency formating of floating numbers like:
 {{ value|floatformat:2 }} built_in filter
 Shay
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---