Shivam Mishra | 823c795 | 2019-05-19 16:01:45 +0530 | [diff] [blame] | 1 | from __future__ import unicode_literals |
| 2 | import erpnext.education.utils as utils |
| 3 | import frappe |
| 4 | |
| 5 | no_cache = 1 |
| 6 | |
| 7 | def get_context(context): |
| 8 | context.education_settings = frappe.get_single("Education Settings") |
Shivam Mishra | 4991fca | 2019-05-30 16:37:15 +0530 | [diff] [blame] | 9 | context.program = get_program(frappe.form_dict['program']) |
| 10 | context.has_access = utils.allowed_program_access(frappe.form_dict['program']) |
Shivam Mishra | 823c795 | 2019-05-19 16:01:45 +0530 | [diff] [blame] | 11 | |
| 12 | def get_program(program_name): |
| 13 | try: |
| 14 | return frappe.get_doc('Program', program_name) |
| 15 | except frappe.DoesNotExistError: |
| 16 | frappe.throw(_("Program {0} does not exist.".format(program_name))) |