On Sun, 2008-07-06 at 14:43 +1000, Malcolm Tredinnick wrote:
> 
> On Sat, 2008-07-05 at 21:23 -0700, Bobby Roberts wrote:
> > what is the best way to handle currency values and then display in the
> > correct currency for the current location.  In the past, in other
> > programming languages, I usually set the field type to decimal, 4
> > places and then when I printed the value on the screen, I just used
> > the included formatcurrency function which rounded to 2 decimal places
> > and put the right currency symbol. 
> 
> You must have also stored the currency as well, then, right? Not just
> the amount, since 1.234 does not mean the same thing when prefixed by
> EUR as it does when prefixed by AUD.
> 
> Django has a decimal field, so that plus a field containing the currency
> type and a short function should do the job here. There's nothing built
> in to do that, since it's not really related to being a web framework
> and is fairly straightforward to do in any case. One day (maybe even
> soon), we'll allow model fields that correspond to multiple columns in
> the database so that you can tie the amount and currency together (and
> even have the "display me" function on the model field). That day isn't
> here yet, however.

By the way, there might be something in Christian Lenz's babel project,
which isn't Django-specific, but a collection of useful localisation
utilities. I can't remember off-hand if there's something for currency
formatting or not.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to