Tech C**P
15 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
To set a variable in jinja2 you can use set as below:
{% set pages_title = 'Pages' %}

As you notice we have used {% %} to set a variable not { }.

#variable #define #jinja2 #template
More about jinja2:

If you want to set a variable named button:
{% set button = 'Login' %}

If you want to include a partial template (child template) into your parent template use include:
{% include 'fa.button.tpl' %}

BE CAREFUL that we have used {% NOT {{ for the code block.

If one of your templates inherits from a main layout use extends directive:
{% extends "layout.tpl" %}

#python #jinja2 #extends #include #set #variable #set_variable #layout