scmmishra | 1778b59 | 2018-10-30 18:25:49 +0530 | [diff] [blame] | 1 | from __future__ import unicode_literals |
| 2 | import frappe |
| 3 | import erpnext.education.utils as utils |
| 4 | |
| 5 | @frappe.whitelist() |
| 6 | def get_portal_details(): |
| 7 | settings = frappe.get_doc("Education Settings") |
| 8 | title = settings.portal_title |
| 9 | description = settings.description |
| 10 | return dict(title=title, description=description) |
| 11 | |
| 12 | @frappe.whitelist() |
| 13 | def get_featured_programs(): |
| 14 | featured_program_names = frappe.get_list("Program", filters={"is_published": True, "is_featured": True}) |
| 15 | featured_list = [program["name"] for program in featured_program_names] |
| 16 | if featured_list: |
| 17 | return featured_list |
| 18 | else: |
| 19 | return None |
| 20 | |
| 21 | @frappe.whitelist() |
| 22 | def get_program_details(program_name): |
| 23 | try: |
| 24 | program = frappe.get_doc('Program', program_name) |
| 25 | return program |
| 26 | except: |
| 27 | return None |