blob: 4c3a3fdf66b4763f42aeed9ef1df759a3aaf40cc [file] [log] [blame]
Shivam Mishra823c7952019-05-19 16:01:45 +05301from __future__ import unicode_literals
2import erpnext.education.utils as utils
3import frappe
4
5no_cache = 1
6
7def get_context(context):
8 context.education_settings = frappe.get_single("Education Settings")
Shivam Mishra4991fca2019-05-30 16:37:15 +05309 context.program = get_program(frappe.form_dict['program'])
10 context.has_access = utils.allowed_program_access(frappe.form_dict['program'])
Shivam Mishra823c7952019-05-19 16:01:45 +053011
12def 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)))