diff --git a/erpnext/education/utils.py b/erpnext/education/utils.py index 9314da2c17..b12ad0c71d 100644 --- a/erpnext/education/utils.py +++ b/erpnext/education/utils.py @@ -162,8 +162,9 @@ def get_program(): else: return None -def get_featured_program(): - featured_list = frappe.get_list("Program", filters={"is_published": True, "is_featured": True}) +def get_featured_programs(): + featured_programs_name = frappe.get_list("Program", filters={"is_published": True, "is_featured": True}) + featured_list = [frappe.get_doc("Program", program["name"]) for program in featured_programs_name] if featured_list: return featured_list else: diff --git a/erpnext/www/lms/index.py b/erpnext/www/lms/index.py index 16772a4f5d..1bba69f470 100644 --- a/erpnext/www/lms/index.py +++ b/erpnext/www/lms/index.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals import frappe +import erpnext.education.utils as utils def get_context(context): - context.featured = frappe.get_all('Program', filters={'is_featured': 1}, fields=['program_name', 'program_code', 'description', 'hero_image']) \ No newline at end of file + context.featured = utils.get_featured_programs() \ No newline at end of file diff --git a/erpnext/www/lms/program.html b/erpnext/www/lms/program.html index 23f2e5c528..5c1f15994c 100644 --- a/erpnext/www/lms/program.html +++ b/erpnext/www/lms/program.html @@ -6,23 +6,23 @@ {% endblock %} -{% macro course_card(name) %} +{% macro course_card(course) %}