From ad3953070556b34d69d8db2fe2eff097df0a18b9 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 26 Oct 2023 11:30:26 +0530 Subject: [PATCH] fix: certificate download template --- lms/www/courses/certificate.html | 4 ++-- lms/www/courses/certificate.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lms/www/courses/certificate.html b/lms/www/courses/certificate.html index 15bea0cdc..e6f47e821 100644 --- a/lms/www/courses/certificate.html +++ b/lms/www/courses/certificate.html @@ -19,9 +19,9 @@
- {% if doc.member == frappe.session.user %} + {% if doc.member == frappe.session.user or is_moderator %}
- + {{ _("Download") }} diff --git a/lms/www/courses/certificate.py b/lms/www/courses/certificate.py index 2931cedb9..3b4839b49 100644 --- a/lms/www/courses/certificate.py +++ b/lms/www/courses/certificate.py @@ -2,6 +2,7 @@ from frappe import _ from frappe.utils.jinja import render_template from frappe.utils import get_url +from lms.lms.utils import has_course_moderator_role def get_context(context): @@ -30,12 +31,14 @@ def get_context(context): "User", context.doc.member, ["full_name", "username"], as_dict=True ) context.url = f"{get_url()}/courses/{context.course.name}/{context.doc.name}" + context.is_moderator = has_course_moderator_role() if context.doc.template: print_format = context.doc.template else: print_format = get_print_format() + context.print_format = print_format template = frappe.db.get_value( "Print Format", print_format, ["html", "css"], as_dict=True )