So I want to be able to insert a function for a string variable which is to be repeated throughout my website.
I have the following function which is located in my __init__.py
document
def string(a):
a = "Hello, this is the repeating string"
return a
In my HTML document, I have the following to call the function:
<HTML code> {{a}} <HTML code>
Why doesn’t it work? It’s just silly This was how I was taught to call a function, it works in the views module when this is specific to one web page and called via the context
variable appended to the ‘render’ function, but when I want this string function to be available to all web pages it just doesn’t want to know. Surely logic would state that this would be the case in the __init__.py
document.
It’s just ridiculous.