the docs say that {% generate_menu %} needs to be called within a block. I think this is not correct, as it seems to need to be called within the same block you are using the menu.
Using a simple pattern to demonstrate this:
# base.html template
<html>
<head>
</head>
<body>
{% block generate_menu %}
{% generate_menu %}
{% endblock %}
{% block content %}
Empty page.
{% endblock %}
</body>
</html>
Now use a template that inherits this:
# application.html
{% extends 'base.html' %}
{% block content %}
Now you should see menus, but you don't.
{{ menus }}
{% endblock %}
Here you just override the content block. The generate_menu block should be inherited by extend and be untouched, so generate_menu should be called - which I can confirm by debugging.
The problem seems to be that the context which is passed to MenuNode.render() does't seem to get passed through to the correct template in application.html.
If I add {% generate_menu %} within the content block in application.html, everything is ok. Even if I add {% generate_menu %} in a new generate_menu block in application.html (which is "a block", like the docs say), it does NOT work.
Is this intended behaviour? Or a bug?
the docs say that
{% generate_menu %}needs to be called within a block. I think this is not correct, as it seems to need to be called within the same block you are using the menu.Using a simple pattern to demonstrate this:
Now use a template that inherits this:
Here you just override the
contentblock. Thegenerate_menublock should be inherited byextendand be untouched, sogenerate_menushould be called - which I can confirm by debugging.The problem seems to be that the context which is passed to
MenuNode.render()does't seem to get passed through to the correct template in application.html.If I add
{% generate_menu %}within thecontentblock inapplication.html, everything is ok. Even if I add{% generate_menu %}in a newgenerate_menublock inapplication.html(which is "a block", like the docs say), it does NOT work.Is this intended behaviour? Or a bug?