March 2019
Intermediate to advanced
412 pages
9h 49m
English
The arguments variable is a tuple of the arguments the macro accepts. These are the explicitly defined arguments, not the special kwargs or varargs. Our previous example would have rendered an empty tuple (), so let's modify it to get something else:
{% macro test(var_a='a string') -%}
{{ test.arguments }}
{%- endmacro -%}
{{ test() }}
Rendering this template will result in the following output:

In this example, we can clearly see that our template rendered with the name of the arguments that the macro accepts (and not their values).
Read now
Unlock full access