Search code examples
pythondjangotemplatestornado

block.super in Tornado template system


In Tornado i have a base template with x block similar below:

{% block x %} x {% end %}

And in second template that inherited from base template i want to mix old value by new value similar django template tag, that is similar below code:

{% block x %} » {{ block.super }} « {% endblock %}

But in Tornado i cant use {{ block.super }}.

Tornado framework has equal django block.super?


Solution

  • Tornado does not currently have any equivalent to Django's block.super. The simplest workaround is to move the part you want to reuse into a separate file so it can be included in both places with {% module Template('foo.html') %}