Ok I have a base.html and I try to use that for my header menu and footer. In my other template I loop over items and display them on the page. My problem is the the other template is repeating my base.html like it’s in the loop. I hope someone can show me the error in My ways.
Here is my base.html code:
<div class="menu">
<ul class="nav">
<li><a href="/">Home</a></li>
<li><a href="/newpost">New Entry</a></li>
<li><a href="/signup">Sign-up</a></li>
{% if user %}
<li>{{user.name}}</li>
<li><a href="/logout">Log-Out</a></li>
{% else %}
<li><a href="/login">Log-In</a></li>
{% endif %}
</ul>
This is in the base.html also but didn’t paste correctly.
<div id="content">
{% block content %}
{% endblock %}
</div>
And here is the sub template code:
{% extends "base.html" %}
{% block content %}
{% for p in posts %}
{{ p.render() | safe }}
<br><br>
{% endfor %}
<div>
{{text}}
</div>
{% endblock %}
Please help
Edit:
edit2: removed link and found my problem I was calling the wrong html file in render()
Be kind Newbie here
Looks ok. Are you sure you don’t have a loop in the python code that renders the template?