From ebcb3c5466bf1693ece9858078f2bbe6566b72bf Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Sun, 5 Dec 2021 00:01:42 +0530 Subject: [PATCH] fix: fixed the issue with rendering custom cohort page Issue #271 --- school/www/cohorts/cohort.html | 2 +- school/www/cohorts/cohort.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/school/www/cohorts/cohort.html b/school/www/cohorts/cohort.html index edfa2434..78d90ba1 100644 --- a/school/www/cohorts/cohort.html +++ b/school/www/cohorts/cohort.html @@ -32,7 +32,7 @@ {% if not page %} {{ render_subgroups() }} {% else %} - {{ cohort.get_page_template(page) }} + {{ render_page(page) }} {% endif %} diff --git a/school/www/cohorts/cohort.py b/school/www/cohorts/cohort.py index dae645f3..e8db20fa 100644 --- a/school/www/cohorts/cohort.py +++ b/school/www/cohorts/cohort.py @@ -31,3 +31,8 @@ def get_context(context): context.is_mentor = is_mentor context.is_admin = is_admin context.page = frappe.form_dict.get("page") or "" + + # Function to render to custom page given the slug + context.render_page = lambda page: frappe.render_template( + cohort.get_page_template(page), + context)