iciren
October 2, 2021, 7:11am
1
Hi guys, I have been trying to return context from .py to display in front end html file through jinja templating. This issue started happening after upgrading to v13.
Older html and their context is working fine, only new html and updating context for the older html not working. Already tried clearing cache and etc.
.py
def get_context(context):
context.testing = frappe.session.user
return context
.html
{{testing}}
It just literally shows “{{testing}}” instead of the value testing variable holds.
Anybody can point me in the right direction? Appreciate it.
3 Likes
Glob
March 23, 2022, 2:09pm
2
Hello,
I am facing the same issue with V13. does anyone have the solution?
One more thing get_context will work if i defined the path inside the hook.py
Awaiting reply.
2 Likes
Can confirm I’m having the same issue
I’m having the same issue
Hello
Frappe v15.17
Dev mode : Y
bench set-config -g server_script_enabled 1
I’m developing a Custom app and define a Website using the Web Page’s Page Builder and selecting the built-in Section with Embed as the template.
[Screenshot from 2024-03-18 10-06-08]
I then click Edit Values and add the following Jinja variable reference to the Embed HTML
[Screenshot from 2024-03-18 10-14-17]
Then under the Web Page’s Scripting > Context > Context Script I add
[Screenshot from 2024-03-18 10-16…
Further to my previous related topic
I also battle to use Dynamic Pages as per the documentation at Dynamic Pages
I’ve created 2 files (test-1.py and test-1.html) in the Custom App’s /www/ directory with the following content
import frappe
def get_context(context):
context.pyvar = "meep"
and
<p>{{ pyvar }}</p>
However, when I browse the page, the Jinja variable does not resolve
[Screenshot from 2024-03-18 17-35-53]
What am I doing wrong?
And is the previous topic referred to abov…