M
M
Michael2014-06-05 20:49:26
Flask
Michael, 2014-06-05 20:49:26

How to render template part of jinja2 parent?

Hello, there is a basic template

{% block topnav %}
     {% for menu in menus %}

         <a href ='{{  url_for("secWiev", slug ={{menu.slug}})'>{{  menu.name}}</a>

     {% endfor %}


   {% endblock%}



 {% block rightnav %}


  {% endblock%}

The menu variable is passed from the server by the controller, and there is a second template that inherits it.

The question is how to make it possible to define a section in the second template?

{% block rightnav %}


  {% endblock%}


Moreover, the contents of the topnav block would be pulled automatically from the parent.

I'll clarify the question a bit... the successor renders a separate controller, how to make the menu variable available from the parent so as not to pass it explicitly in the successor's controller?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
orion_tvv, 2014-06-10
@orion_tvv

{% block rightnav %}
{% endblock%}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question