From 914ecac9ac757a5175b63df832616c2f943ee983 Mon Sep 17 00:00:00 2001 From: Muhammad Shoaib Date: Thu, 4 Dec 2014 14:09:21 +0500 Subject: [PATCH] added the course price in the course about page --- lms/djangoapps/courseware/tests/test_about.py | 12 ++++++++++++ lms/djangoapps/courseware/views.py | 1 + lms/templates/courseware/course_about.html | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/lms/djangoapps/courseware/tests/test_about.py b/lms/djangoapps/courseware/tests/test_about.py index 0231656313..b9bdb1233d 100644 --- a/lms/djangoapps/courseware/tests/test_about.py +++ b/lms/djangoapps/courseware/tests/test_about.py @@ -322,6 +322,14 @@ class AboutWithClosedEnrollment(ModuleStoreTestCase): # Check that registration button is not present self.assertNotIn(REG_STR, resp.content) + def test_course_price_is_not_visble_in_sidebar(self): + url = reverse('about_course', args=[self.course.id.to_deprecated_string()]) + resp = self.client.get(url) + self.assertEqual(resp.status_code, 200) + # course price is not visible ihe course_about page when the course + # mode is not set to honor + self.assertNotIn('$10', resp.content) + @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) @patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': True}) @@ -421,6 +429,10 @@ class AboutPurchaseCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): self.assertIn("Enrollment is Closed", resp.content) self.assertNotIn("Add buyme to Cart ($10)", resp.content) + # course price is visible ihe course_about page when the course + # mode is set to honor and it's price is set + self.assertIn('$10', resp.content) + def test_invitation_only(self): """ This makes sure that the invitation only restirction takes prescendence over diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index 802c3ef917..0d92c1ca23 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -793,6 +793,7 @@ def course_about(request, course_id): 'registered': registered, 'course_target': course_target, 'registration_price': registration_price, + 'currency_symbol': settings.PAID_COURSE_REGISTRATION_CURRENCY[1], 'in_cart': in_cart, 'reg_then_add_to_cart_link': reg_then_add_to_cart_link, 'show_courseware_link': show_courseware_link, diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index af267f2284..f2e24cf5ae 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -311,6 +311,14 @@ ##
  • ${_('Course Length')}

    ${_('{number} weeks').format(number=15)}
  • + %if is_shopping_cart_enabled and registration_price: +
  • + +

    ${_("Price")}

    + ${_("{currency_symbol}{cost}").format(currency_symbol=currency_symbol, cost=registration_price)} +
  • + % endif + % if get_course_about_section(course, "prerequisites"):
  • ${_("Prerequisites")}

    ${get_course_about_section(course, "prerequisites")}
  • % endif