feat: read only mode

This commit is contained in:
Jannat Patel
2025-04-30 18:03:00 +05:30
parent 0d32c2a9d9
commit 603e80fd26
26 changed files with 427 additions and 302 deletions

View File

@@ -8,6 +8,10 @@ no_cache = 1
def get_context():
context = frappe._dict()
context.boot = get_boot()
frappe.db.commit()
app_path = frappe.form_dict.get("app_path")
favicon = (
frappe.db.get_single_value("Website Settings", "favicon")
@@ -15,19 +19,24 @@ def get_context():
)
title = frappe.db.get_single_value("Website Settings", "app_name") or "Frappe Learning"
csrf_token = frappe.sessions.get_csrf_token()
frappe.db.commit()
context = frappe._dict()
context.csrf_token = csrf_token
context.read_only = frappe.flags.read_only
context.meta = get_meta(app_path, title, favicon)
capture("active_site", "lms")
context.title = title
context.favicon = favicon
capture("active_site", "lms")
return context
def get_boot():
return frappe._dict(
{
"frappe_version": frappe.__version__,
"read_only_mode": frappe.flags.read_only,
"csrf_token": frappe.sessions.get_csrf_token(),
}
)
def get_meta(app_path, title, favicon):
meta = frappe._dict()
if app_path: