From 2dd128bce0fbef32a001c6c034386e19e8d0283f Mon Sep 17 00:00:00 2001
From: Diego Millan <diego.millan@edunext.co>
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 ccbed449f9b..6569e245f62 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 c4482ab82c8..4e4e976ab4d 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
             <span>${_('Pursue a Verified Certificate')}</span>
     % endif
         % if price_before_discount:
-        (<span class="upgrade-price-string">$${min_price} USD</span> <del> <span class="upgrade-price-string">${Text('${price} USD').format(price=price_before_discount)}</span></del>)
+        (<span class="upgrade-price-string">${currency_symbol}${min_price} ${currency}</span> <del> <span class="upgrade-price-string">${Text('{currency_symbol}{price} {currency}').format(currency_symbol=currency_symbol, price=price_before_discount, currency=currency)}</span></del>)
         % else:
-        (<span class="upgrade-price-string">$${min_price} USD</span>)
+        (<span class="upgrade-price-string">${currency_symbol}${min_price} ${currency}</span>)
         % endif
         </button>
 </li>
\ No newline at end of file
diff --git a/lms/templates/course_modes/choose.html b/lms/templates/course_modes/choose.html
index 20ee9dcaf46..e931208c60a 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
                                                 </div>
                                                 <div class="copy-inline list-actions">
                                                     <ul class="list-actions">
-                                                        <%include file='_upgrade_button.html' args='content_gating_enabled=content_gating_enabled, course_duration_limit_enabled=course_duration_limit_enabled, min_price=min_price, price_before_discount=price_before_discount' />
+                                                        <%include file='_upgrade_button.html' args='content_gating_enabled=content_gating_enabled, course_duration_limit_enabled=course_duration_limit_enabled, currency=currency, currency_symbol=currency_symbol, min_price=min_price, price_before_discount=price_before_discount' />
                                                     </ul>
                                                 </div>
                                             </div>
@@ -165,7 +165,7 @@ from openedx.core.djangolib.markup import HTML, Text
                                                 </div>
                                                 <div class="copy-inline list-actions">
                                                     <ul class="list-actions">
-                                                        <%include file='_upgrade_button.html' args='content_gating_enabled=content_gating_enabled, course_duration_limit_enabled=course_duration_limit_enabled, min_price=min_price, price_before_discount=price_before_discount' />
+                                                        <%include file='_upgrade_button.html' args='content_gating_enabled=content_gating_enabled, course_duration_limit_enabled=course_duration_limit_enabled, currency=currency, currency_symbol=currency_symbol, min_price=min_price, price_before_discount=price_before_discount' />
                                                     </ul>
                                                 </div>
                                             </div>
-- 
GitLab