Is there a way to pass variables into Jinja2 parents?

后端 未结 3 789
北海茫月
北海茫月 2021-01-04 02:15

I\'m trying to pass some variables from the child page to the template. This is my python code:

    if self.request.url.find(\"&try\") == 1:
        isTr         


        
3条回答
  •  -上瘾入骨i
    2021-01-04 03:04

    I think that you are looking to highlight active menus in the base layout and you need something like this

    {% extends 'base.html' %}
    {% set active = "clients" %}
    

    then use can use "active" inside base.html

提交回复
热议问题