refactor: moved courses/*/index pages to batch/*

This commit is contained in:
Anand Chitipothu
2021-05-21 13:12:52 +05:30
parent a2b856aaf8
commit e04bbb633d
20 changed files with 148 additions and 81 deletions

View File

@@ -0,0 +1,20 @@
import frappe
from community.lms.models import Course
def get_context(context):
context.no_cache = 1
course_name = frappe.form_dict["course"]
batch_name = frappe.form_dict["batch"]
course = Course.find(course_name)
if not course:
context.template = "www/404.html"
return
batch = course.get_batch(batch_name)
if not batch:
frappe.local.flags.redirect_location = "/courses/" + course_name
raise frappe.Redirect
context.course = course
context.batch = batch