Idea is to provide users a functionality so that by using {% exec %} templatetag, they can evaluate a string based template (say passed as an argument) as a part of the original template.
For example user can define a macro in string and use that in the same execution flow.
Our use case was that user can define macros in yaml and then call it from the yaml itself and we should be able to treat the macro as one of the predefined macros. Earlier we were doing two step evaluation but that limited the capability of the system.
We could not define this templateTag from outside as it has to use few variables private to the package.
Idea is to provide users a functionality so that by using
{% exec %}
templatetag, they can evaluate a string based template (say passed as an argument) as a part of the original template.For example user can define a macro in string and use that in the same execution flow.
Our use case was that user can define macros in yaml and then call it from the yaml itself and we should be able to treat the macro as one of the predefined macros. Earlier we were doing two step evaluation but that limited the capability of the system.
We could not define this templateTag from outside as it has to use few variables private to the package.
some_file.template
so effectively this file will be evaluated as
and the result will be