Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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") }}
Comment

PREVIOUS NEXT
Code Example
Python :: remove string punctuation python 3 
Python :: django.db.utils.ProgrammingError: relation "users" does not exist in django 3.0 
Python :: python env 
Python :: drop all characters after a character in python 
Python :: sieve of eratosthenes python 
Python :: django migrate fake zero 
Python :: output path jupyter 
Python :: selenium get parent element 
Python :: how to insert item last in list python 
Python :: float to string python 
Python :: django models integer field default value 
Python :: pytorch optimizer change learning rate 
Python :: length of dataframe 
Python :: how to reverse a list in python without using inbuilt function 
Python :: shuffle list 
Python :: python f string 
Python :: feature importance plot 
Python :: making a basic network scanner using python 
Python :: python pynput space 
Python :: validate ip address python 
Python :: valor absoluto en python 
Python :: flask quickstart 
Python :: How to do train test split in keras Imagedatagenerator 
Python :: pip install python-telegram-bot 
Python :: multiclass ROC AUC curve 
Python :: outliers removal 
Python :: how to make a string case insensitive in python 
Python :: flask port 
Python :: pandas index between time 
Python :: 2d gaussian function python 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =