I know there are reference processors that can do this, but I want to set the global template variable in the template tag. So far I have tried this: Ie repeat all the references and Set the variable, but it does not work. Can anyone explain how to do this? For example, base.html: child.html: Note that its use (possibly) takes some of your business logic into your template, but sometimes it's OK.
{{my_var}} {# I set this variable in child template #} {% block content%} {% endblock%}
{% extended 'base.html'%} {% block content%} {% my_var%} Hello {% endset%} {
Comments
Post a Comment