From the documentation you can see that the tags of the letter templates include a record of the objective function and visualization tools. Therefore, I assume that your current code is as follows:
def my_tag(parser, token):
return MyNode(...)
class MyNode(template.Node):
def render(self, context):
So essentially you need to hang the variable in context so that you can know if for this particular request you have already included code to load all the necessary scripts.
class MyNode(template.Node):
def render(self, context):
if '_included_faceboxify_deps' in context:
context['_included_faceboxify_deps'] = True
That should do the trick. This is not as elegant as including your dependencies at the top of the page, but just not including them every time you need to name them.
source
share