Skip to content

Commit

Permalink
Added formatted_currency
Browse files Browse the repository at this point in the history
  • Loading branch information
ddanier committed Oct 26, 2012
1 parent 605e43b commit 62d9898
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion django_price/price.py
Expand Up @@ -63,7 +63,7 @@ def __unicode__(self):
from django.utils.translation import ugettext
return ugettext('%(currency)s %(amount)s') % {
'amount': self.formatted_gross,
'currency': self.currency.symbol if self.currency.symbol else self.currency.iso_code,
'currency': self.formatted_currency,
}

def copy(self):
Expand Down Expand Up @@ -117,6 +117,10 @@ def applied_taxes(self):
in self._applied_taxes.values()
]

@property
def formatted_currency(self):
return self.currency.symbol if self.currency.symbol else self.currency.iso_code

def _format_amount(self, value):
from django.utils.formats import number_format
# workaround for django not treating decimal_places==0 is implied
Expand Down

0 comments on commit 62d9898

Please sign in to comment.