Answers for "jinja macro import"

0

jinja macro import

# This is how you define the macro
# This is in the file "Input_Block"
{% macro input(name, value='', type='text', size=20) -%}
    <input type="{{ type }}" name="{{ name }}" value="{{
        value|e }}" size="{{ size }}">
{%- endmacro %}

# Import from the file and set a contextual name
{% import 'Input_Block' as emailBlock %}
{{ emailBlock.input("user input") }}
Posted by: Guest on January-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language