Files
enlight-lms/lms/www/certificate.py
2025-08-11 17:48:37 +05:30

14 lines
452 B
Python

from urllib.parse import quote
import frappe
def get_context(context):
context.no_cache = 1
template = frappe.db.get_value("LMS Certificate", frappe.form_dict.certificate_id, "template")
certificate_id = frappe.form_dict.certificate_id
template = quote(template)
frappe.local.flags.redirect_location = f"/api/method/frappe.utils.print_format.download_pdf?doctype=LMS+Certificate&name={certificate_id}&format={template}"
raise frappe.Redirect