Indian Rupee Currency Symbol

590 views
Skip to first unread message

Pawan Kumar

unread,
Nov 26, 2013, 2:02:02 AM11/26/13
to django...@googlegroups.com
Hi All

Can some pl give me insight as how to render Indian Rupee symbol?

http://en.wikipedia.org/wiki/Indian_rupee_sign

Current config:
OSCAR_DEFAULT_CURRENCY = 'INR'
OSCAR_CURRENCY_LOCALE = 'en_US'
OSCAR_CURRENCY_FORMAT = 'INR #,###.##'

Its still showing INR against price instead of  INR

Thanks
Pawan

Sebastian Vetter

unread,
Nov 26, 2013, 5:41:14 AM11/26/13
to django...@googlegroups.com
Hi Pawan,

> Can some pl give me insight as how to render Indian Rupee symbol?

We've set up an Indian site recently and have used the webrupee [1]
package to display the currency symbol in a robust way. It provides a
simple webfont with the Rupee symbol. All we had to do was add the CSS
as described on their website:

<link rel="stylesheet" type="text/css" href="http://cdn.webrupee.com/font">

Then define the currency format like this:

# Currency
OSCAR_DEFAULT_CURRENCY = u'INR'
OSCAR_CURRENCY_FORMAT = u'<span class="WebRupee">Rs</span> #,##0'

And then make sure that you use the 'safe' filter whenever you use
Oscar's 'currency' filter to make sure that the HTML in the format above
isn't escaped. We ended up overriding the currency filter in Oscar with
our own to ensure safe everywhere:

@register.filter(name='currency')
def currency(value):
"""
Format decimal value as currency
"""
try:
value = D(value)
except (TypeError, InvalidOperation):
return u""
# Using Babel's currency formatting
#
http://packages.python.org/Babel/api/babel.numbers-module.html#format_currency
kwargs = {
'currency': settings.OSCAR_DEFAULT_CURRENCY,
'format': getattr(settings, 'OSCAR_CURRENCY_FORMAT', None)}
locale = getattr(settings, 'OSCAR_CURRENCY_LOCALE', None)
if locale:
kwargs['locale'] = locale
return safe(format_currency(value, **kwargs))

I hope that helps.

Cheers,
Seb

[1] http://webrupee.com/

Pawan Kumar

unread,
Nov 26, 2013, 6:45:07 AM11/26/13
to django...@googlegroups.com
Sebastian

Thanks, I will check it.

Pawan

Pawan Kumar

unread,
Nov 27, 2013, 6:48:02 AM11/27/13
to django...@googlegroups.com
Sebatian

It worked. Thanks!
Pawan
Reply all
Reply to author
Forward
0 new messages