From 2dd128bce0fbef32a001c6c034386e19e8d0283f Mon Sep 17 00:00:00 2001 From: Diego Millan Date: Wed, 20 Feb 2019 15:50:49 -0500 Subject: [PATCH] Setting template to show currency defined in the course mode DB record --- common/djangoapps/course_modes/views.py | 2 ++ lms/templates/course_modes/_upgrade_button.html | 4 ++-- lms/templates/course_modes/choose.html | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/djangoapps/course_modes/views.py b/common/djangoapps/course_modes/views.py index ccbed449f9..6569e245f6 100644 --- a/common/djangoapps/course_modes/views.py +++ b/common/djangoapps/course_modes/views.py @@ -13,6 +13,7 @@ import six.moves.urllib.parse import six.moves.urllib.request import waffle from babel.dates import format_datetime +from babel.numbers import get_currency_symbol from django.contrib.auth.decorators import login_required from django.db import transaction from django.http import HttpResponse, HttpResponseBadRequest @@ -208,6 +209,7 @@ class ChooseModeView(View): price_before_discount = verified_mode.min_price context["currency"] = verified_mode.currency.upper() + context["currency_symbol"] = get_currency_symbol(verified_mode.currency.upper()) context["min_price"] = price_before_discount context["verified_name"] = verified_mode.name context["verified_description"] = verified_mode.description diff --git a/lms/templates/course_modes/_upgrade_button.html b/lms/templates/course_modes/_upgrade_button.html index c4482ab82c..4e4e976ab4 100644 --- a/lms/templates/course_modes/_upgrade_button.html +++ b/lms/templates/course_modes/_upgrade_button.html @@ -17,9 +17,9 @@ from openedx.core.djangolib.markup import HTML, Text ${_('Pursue a Verified Certificate')} % endif % if price_before_discount: - ($${min_price} USD ${Text('${price} USD').format(price=price_before_discount)}) + (${currency_symbol}${min_price} ${currency} ${Text('{currency_symbol}{price} {currency}').format(currency_symbol=currency_symbol, price=price_before_discount, currency=currency)}) % else: - ($${min_price} USD) + (${currency_symbol}${min_price} ${currency}) % endif \ No newline at end of file diff --git a/lms/templates/course_modes/choose.html b/lms/templates/course_modes/choose.html index 20ee9dcaf4..e931208c60 100644 --- a/lms/templates/course_modes/choose.html +++ b/lms/templates/course_modes/choose.html @@ -124,7 +124,7 @@ from openedx.core.djangolib.markup import HTML, Text
@@ -165,7 +165,7 @@ from openedx.core.djangolib.markup import HTML, Text