Files
enlight-lms/lms/www/batch/edit.py
2023-05-02 11:09:46 +05:30

18 lines
697 B
Python

import frappe
from lms.www.utils import get_current_lesson_details, get_common_context
from lms.lms.utils import is_instructor, has_course_moderator_role
from frappe import _
def get_context(context):
get_common_context(context)
chapter_index = frappe.form_dict.get("chapter")
lesson_index = frappe.form_dict.get("lesson")
lesson_number = f"{chapter_index}.{lesson_index}"
context.lesson = get_current_lesson_details(lesson_number, context, True)
context.is_moderator = has_course_moderator_role()
instructor = is_instructor(context.course.name)
if not instructor and not has_course_moderator_role():
raise frappe.PermissionError(_("You do not have permission to access this page."))