我想在宏中使用宏。但这是如何运作的?
宏:
{% import _self as formSubmacros %}
{% macro printSubcategoriesRow(SubcategoriesForm) %}
<div class="the content of the subcatecories">
</div>
{% endmacro %}
宏我在第一个下写,我想在这里得到1个宏:
{% import _self as formMacros %}
{% macro printCategoriesRow(CategoriesForm) %}
<div class="the content of the categories with the macro subcategories">
{% for SubcategoriesForm in CategoriesForm.subcategories %}
{{ formSubmacros.printSubcategoriesRow(SubcategoriesForm) }}
{% endfor %}
</div>
{% endmacro %}
但这不起作用......
答案 0 :(得分:0)
您应该将import
放入宏中,以获得适当的范围。如果这不起作用,请提供错误消息