I'm working on a project. I have a strings.py
which has dicts
like below:
def bar(self):
#do something
STRINGS_ENGLISH = {
'title': 'foo'
'function': bar
}
then I wanna use this string in my Django template, I'll pass it through my context in the template named string
.
I know that If I wanna print the title
in the HTML it's enough to write {{strings.title}}
,
but about the function I want to pass it to a button like that:
<button onclick="{function()}">Do Something</button>
but it's a python function! not a js function. so what should I do?