feat: students view for classes

This commit is contained in:
Jannat Patel
2022-11-25 17:46:46 +05:30
parent 66ddea2031
commit f566211d82
16 changed files with 182 additions and 141 deletions

View File

@@ -5,20 +5,12 @@ from frappe import _
def get_context(context):
context.no_cache = 1
if not has_course_moderator_role():
message = "Only Moderators have access to this page."
if frappe.session.user == "Guest":
message = "Please login to access this page."
raise frappe.PermissionError(_(message))
class_name = frappe.form_dict["classname"]
context.class_info = frappe.db.get_value(
"LMS Class",
class_name,
["name", "title", "start_date", "end_date", "description"],
["name", "title", "start_date", "end_date", "description", "custom_component"],
as_dict=True,
)
@@ -33,3 +25,5 @@ def get_context(context):
context.class_students = frappe.get_all(
"Class Student", {"parent": class_name}, ["student", "student_name", "username"]
)
context.is_moderator = has_course_moderator_role()